ut: format testcases
This commit is contained in:
parent
00fbfe274a
commit
edbed0a167
6 changed files with 422 additions and 123 deletions
|
|
@ -30,8 +30,13 @@ class TestBuild(unittest.TestCase):
|
|||
@mock.patch('koji_cli._unique_path', return_value='random_path')
|
||||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_build_from_srpm(self, watch_tasks_mock, running_in_bg_mock, unique_path_mock, activate_session_mock,
|
||||
stdout):
|
||||
def test_handle_build_from_srpm(
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
unique_path_mock,
|
||||
activate_session_mock,
|
||||
stdout):
|
||||
target = 'target'
|
||||
dest_tag = 'dest_tag'
|
||||
target_info = {'dest_tag': dest_tag}
|
||||
|
|
@ -62,10 +67,13 @@ Task info: weburl/taskinfo?taskID=1
|
|||
self.session.getTag.assert_called_once_with(dest_tag)
|
||||
unique_path_mock.assert_called_once_with('cli-build')
|
||||
self.assertEqual(running_in_bg_mock.call_count, 2)
|
||||
self.session.uploadWrapper.assert_called_once_with(source, 'random_path', callback=cli._progress_callback)
|
||||
self.session.build.assert_called_once_with('random_path/' + source, target, opts, priority=priority)
|
||||
self.session.uploadWrapper.assert_called_once_with(
|
||||
source, 'random_path', callback=cli._progress_callback)
|
||||
self.session.build.assert_called_once_with(
|
||||
'random_path/' + source, target, opts, priority=priority)
|
||||
self.session.logout.assert_called()
|
||||
watch_tasks_mock.assert_called_once_with(self.session, [task_id], quiet=self.options.quiet)
|
||||
watch_tasks_mock.assert_called_once_with(
|
||||
self.session, [task_id], quiet=self.options.quiet)
|
||||
self.assertEqual(rv, 0)
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=stringio.StringIO)
|
||||
|
|
@ -73,8 +81,13 @@ Task info: weburl/taskinfo?taskID=1
|
|||
@mock.patch('koji_cli._unique_path', return_value='random_path')
|
||||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_build_from_scm(self, watch_tasks_mock, running_in_bg_mock, unique_path_mock,
|
||||
activate_session_mock, stdout):
|
||||
def test_handle_build_from_scm(
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
unique_path_mock,
|
||||
activate_session_mock,
|
||||
stdout):
|
||||
target = 'target'
|
||||
dest_tag = 'dest_tag'
|
||||
target_info = {'dest_tag': dest_tag}
|
||||
|
|
@ -104,9 +117,11 @@ Task info: weburl/taskinfo?taskID=1
|
|||
unique_path_mock.assert_not_called()
|
||||
running_in_bg_mock.assert_called_once()
|
||||
self.session.uploadWrapper.assert_not_called()
|
||||
self.session.build.assert_called_once_with(source, target, opts, priority=priority)
|
||||
self.session.build.assert_called_once_with(
|
||||
source, target, opts, priority=priority)
|
||||
self.session.logout.assert_called()
|
||||
watch_tasks_mock.assert_called_once_with(self.session, [task_id], quiet=self.options.quiet)
|
||||
watch_tasks_mock.assert_called_once_with(
|
||||
self.session, [task_id], quiet=self.options.quiet)
|
||||
self.assertEqual(rv, 0)
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=stringio.StringIO)
|
||||
|
|
@ -116,7 +131,13 @@ Task info: weburl/taskinfo?taskID=1
|
|||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_build_no_arg(
|
||||
self, watch_tasks_mock, running_in_bg_mock, unique_path_mock, activate_session_mock, stderr, stdout):
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
unique_path_mock,
|
||||
activate_session_mock,
|
||||
stderr,
|
||||
stdout):
|
||||
args = []
|
||||
progname = os.path.basename(sys.argv[0]) or 'koji'
|
||||
|
||||
|
|
@ -153,7 +174,13 @@ Task info: weburl/taskinfo?taskID=1
|
|||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_build_help(
|
||||
self, watch_tasks_mock, running_in_bg_mock, unique_path_mock, activate_session_mock, stderr, stdout):
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
unique_path_mock,
|
||||
activate_session_mock,
|
||||
stderr,
|
||||
stdout):
|
||||
args = ['--help']
|
||||
progname = os.path.basename(sys.argv[0]) or 'koji'
|
||||
|
||||
|
|
@ -201,7 +228,13 @@ Options:
|
|||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_build_arch_override_denied(
|
||||
self, watch_tasks_mock, running_in_bg_mock, unique_path_mock, activate_session_mock, stderr, stdout):
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
unique_path_mock,
|
||||
activate_session_mock,
|
||||
stderr,
|
||||
stdout):
|
||||
target = 'target'
|
||||
source = 'http://scm'
|
||||
arch_override = 'somearch'
|
||||
|
|
@ -239,8 +272,13 @@ Options:
|
|||
@mock.patch('koji_cli._unique_path', return_value='random_path')
|
||||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_build_none_tag(self, watch_tasks_mock, running_in_bg_mock, unique_path_mock,
|
||||
activate_session_mock, stdout):
|
||||
def test_handle_build_none_tag(
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
unique_path_mock,
|
||||
activate_session_mock,
|
||||
stdout):
|
||||
target = 'nOne'
|
||||
source = 'http://scm'
|
||||
task_id = 1
|
||||
|
|
@ -267,9 +305,11 @@ Task info: weburl/taskinfo?taskID=1
|
|||
running_in_bg_mock.assert_called_once()
|
||||
self.session.uploadWrapper.assert_not_called()
|
||||
# target==None, repo_id==2, skip_tag==True
|
||||
self.session.build.assert_called_once_with(source, None, opts, priority=priority)
|
||||
self.session.build.assert_called_once_with(
|
||||
source, None, opts, priority=priority)
|
||||
self.session.logout.assert_called()
|
||||
watch_tasks_mock.assert_called_once_with(self.session, [task_id], quiet=self.options.quiet)
|
||||
watch_tasks_mock.assert_called_once_with(
|
||||
self.session, [task_id], quiet=self.options.quiet)
|
||||
self.assertEqual(rv, 0)
|
||||
|
||||
@mock.patch('sys.stderr', new_callable=stringio.StringIO)
|
||||
|
|
@ -277,8 +317,13 @@ Task info: weburl/taskinfo?taskID=1
|
|||
@mock.patch('koji_cli._unique_path', return_value='random_path')
|
||||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_build_target_not_found(self, watch_tasks_mock, running_in_bg_mock, unique_path_mock,
|
||||
activate_session_mock, stderr):
|
||||
def test_handle_build_target_not_found(
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
unique_path_mock,
|
||||
activate_session_mock,
|
||||
stderr):
|
||||
target = 'target'
|
||||
target_info = None
|
||||
source = 'http://scm'
|
||||
|
|
@ -316,8 +361,13 @@ Task info: weburl/taskinfo?taskID=1
|
|||
@mock.patch('koji_cli._unique_path', return_value='random_path')
|
||||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_build_dest_tag_not_found(self, watch_tasks_mock, running_in_bg_mock, unique_path_mock,
|
||||
activate_session_mock, stderr):
|
||||
def test_handle_build_dest_tag_not_found(
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
unique_path_mock,
|
||||
activate_session_mock,
|
||||
stderr):
|
||||
target = 'target'
|
||||
dest_tag = 'dest_tag'
|
||||
dest_tag_name = 'dest_tag_name'
|
||||
|
|
@ -359,8 +409,13 @@ Task info: weburl/taskinfo?taskID=1
|
|||
@mock.patch('koji_cli._unique_path', return_value='random_path')
|
||||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_build_dest_tag_locked(self, watch_tasks_mock, running_in_bg_mock, unique_path_mock,
|
||||
activate_session_mock, stderr):
|
||||
def test_handle_build_dest_tag_locked(
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
unique_path_mock,
|
||||
activate_session_mock,
|
||||
stderr):
|
||||
target = 'target'
|
||||
dest_tag = 'dest_tag'
|
||||
dest_tag_name = 'dest_tag_name'
|
||||
|
|
@ -402,8 +457,13 @@ Task info: weburl/taskinfo?taskID=1
|
|||
@mock.patch('koji_cli._unique_path', return_value='random_path')
|
||||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_build_arch_override(self, watch_tasks_mock, running_in_bg_mock, unique_path_mock,
|
||||
activate_session_mock, stdout):
|
||||
def test_handle_build_arch_override(
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
unique_path_mock,
|
||||
activate_session_mock,
|
||||
stdout):
|
||||
target = 'target'
|
||||
dest_tag = 'dest_tag'
|
||||
target_info = {'dest_tag': dest_tag}
|
||||
|
|
@ -411,7 +471,12 @@ Task info: weburl/taskinfo?taskID=1
|
|||
source = 'http://scm'
|
||||
task_id = 1
|
||||
arch_override = 'somearch'
|
||||
args = ['--arch-override=' + arch_override, '--scratch', target, source]
|
||||
args = [
|
||||
'--arch-override=' +
|
||||
arch_override,
|
||||
'--scratch',
|
||||
target,
|
||||
source]
|
||||
opts = {'arch_override': arch_override, 'scratch': True}
|
||||
priority = None
|
||||
|
||||
|
|
@ -435,9 +500,11 @@ Task info: weburl/taskinfo?taskID=1
|
|||
running_in_bg_mock.assert_called_once()
|
||||
self.session.uploadWrapper.assert_not_called()
|
||||
# arch-override=='somearch', scratch==True
|
||||
self.session.build.assert_called_once_with(source, target, opts, priority=priority)
|
||||
self.session.build.assert_called_once_with(
|
||||
source, target, opts, priority=priority)
|
||||
self.session.logout.assert_called()
|
||||
watch_tasks_mock.assert_called_once_with(self.session, [task_id], quiet=self.options.quiet)
|
||||
watch_tasks_mock.assert_called_once_with(
|
||||
self.session, [task_id], quiet=self.options.quiet)
|
||||
self.assertEqual(rv, 0)
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=stringio.StringIO)
|
||||
|
|
@ -445,8 +512,13 @@ Task info: weburl/taskinfo?taskID=1
|
|||
@mock.patch('koji_cli._unique_path', return_value='random_path')
|
||||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_build_background(self, watch_tasks_mock, running_in_bg_mock, unique_path_mock,
|
||||
activate_session_mock, stdout):
|
||||
def test_handle_build_background(
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
unique_path_mock,
|
||||
activate_session_mock,
|
||||
stdout):
|
||||
target = 'target'
|
||||
dest_tag = 'dest_tag'
|
||||
target_info = {'dest_tag': dest_tag}
|
||||
|
|
@ -476,9 +548,11 @@ Task info: weburl/taskinfo?taskID=1
|
|||
unique_path_mock.assert_not_called()
|
||||
running_in_bg_mock.assert_called_once()
|
||||
self.session.uploadWrapper.assert_not_called()
|
||||
self.session.build.assert_called_once_with(source, target, opts, priority=priority)
|
||||
self.session.build.assert_called_once_with(
|
||||
source, target, opts, priority=priority)
|
||||
self.session.logout.assert_called()
|
||||
watch_tasks_mock.assert_called_once_with(self.session, [task_id], quiet=self.options.quiet)
|
||||
watch_tasks_mock.assert_called_once_with(
|
||||
self.session, [task_id], quiet=self.options.quiet)
|
||||
self.assertEqual(rv, 0)
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=stringio.StringIO)
|
||||
|
|
@ -486,8 +560,13 @@ Task info: weburl/taskinfo?taskID=1
|
|||
@mock.patch('koji_cli._unique_path', return_value='random_path')
|
||||
@mock.patch('koji_cli._running_in_bg', return_value=True)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_build_running_in_bg(self, watch_tasks_mock, running_in_bg_mock, unique_path_mock,
|
||||
activate_session_mock, stdout):
|
||||
def test_handle_build_running_in_bg(
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
unique_path_mock,
|
||||
activate_session_mock,
|
||||
stdout):
|
||||
target = 'target'
|
||||
dest_tag = 'dest_tag'
|
||||
target_info = {'dest_tag': dest_tag}
|
||||
|
|
@ -519,8 +598,10 @@ Task info: weburl/taskinfo?taskID=1
|
|||
unique_path_mock.assert_called_once_with('cli-build')
|
||||
self.assertEqual(running_in_bg_mock.call_count, 2)
|
||||
# callback==None
|
||||
self.session.uploadWrapper.assert_called_once_with(source, 'random_path', callback=None)
|
||||
self.session.build.assert_called_once_with('random_path/' + source, target, opts, priority=priority)
|
||||
self.session.uploadWrapper.assert_called_once_with(
|
||||
source, 'random_path', callback=None)
|
||||
self.session.build.assert_called_once_with(
|
||||
'random_path/' + source, target, opts, priority=priority)
|
||||
self.session.logout.assert_not_called()
|
||||
watch_tasks_mock.assert_not_called()
|
||||
self.assertIsNone(rv)
|
||||
|
|
@ -530,8 +611,13 @@ Task info: weburl/taskinfo?taskID=1
|
|||
@mock.patch('koji_cli._unique_path', return_value='random_path')
|
||||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_build_noprogress(self, watch_tasks_mock, running_in_bg_mock, unique_path_mock,
|
||||
activate_session_mock, stdout):
|
||||
def test_handle_build_noprogress(
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
unique_path_mock,
|
||||
activate_session_mock,
|
||||
stdout):
|
||||
target = 'target'
|
||||
dest_tag = 'dest_tag'
|
||||
target_info = {'dest_tag': dest_tag}
|
||||
|
|
@ -563,10 +649,13 @@ Task info: weburl/taskinfo?taskID=1
|
|||
unique_path_mock.assert_called_once_with('cli-build')
|
||||
self.assertEqual(running_in_bg_mock.call_count, 2)
|
||||
# callback==None
|
||||
self.session.uploadWrapper.assert_called_once_with(source, 'random_path', callback=None)
|
||||
self.session.build.assert_called_once_with('random_path/' + source, target, opts, priority=priority)
|
||||
self.session.uploadWrapper.assert_called_once_with(
|
||||
source, 'random_path', callback=None)
|
||||
self.session.build.assert_called_once_with(
|
||||
'random_path/' + source, target, opts, priority=priority)
|
||||
self.session.logout.assert_called_once()
|
||||
watch_tasks_mock.assert_called_once_with(self.session, [task_id], quiet=self.options.quiet)
|
||||
watch_tasks_mock.assert_called_once_with(
|
||||
self.session, [task_id], quiet=self.options.quiet)
|
||||
self.assertEqual(rv, 0)
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=stringio.StringIO)
|
||||
|
|
@ -574,8 +663,13 @@ Task info: weburl/taskinfo?taskID=1
|
|||
@mock.patch('koji_cli._unique_path', return_value='random_path')
|
||||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_build_quiet(self, watch_tasks_mock, running_in_bg_mock, unique_path_mock,
|
||||
activate_session_mock, stdout):
|
||||
def test_handle_build_quiet(
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
unique_path_mock,
|
||||
activate_session_mock,
|
||||
stdout):
|
||||
target = 'target'
|
||||
dest_tag = 'dest_tag'
|
||||
target_info = {'dest_tag': dest_tag}
|
||||
|
|
@ -604,10 +698,13 @@ Task info: weburl/taskinfo?taskID=1
|
|||
unique_path_mock.assert_called_once_with('cli-build')
|
||||
self.assertEqual(running_in_bg_mock.call_count, 2)
|
||||
# callback==None
|
||||
self.session.uploadWrapper.assert_called_once_with(source, 'random_path', callback=None)
|
||||
self.session.build.assert_called_once_with('random_path/' + source, target, opts, priority=priority)
|
||||
self.session.uploadWrapper.assert_called_once_with(
|
||||
source, 'random_path', callback=None)
|
||||
self.session.build.assert_called_once_with(
|
||||
'random_path/' + source, target, opts, priority=priority)
|
||||
self.session.logout.assert_called_once()
|
||||
watch_tasks_mock.assert_called_once_with(self.session, [task_id], quiet=quiet)
|
||||
watch_tasks_mock.assert_called_once_with(
|
||||
self.session, [task_id], quiet=quiet)
|
||||
self.assertEqual(rv, 0)
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=stringio.StringIO)
|
||||
|
|
@ -615,8 +712,13 @@ Task info: weburl/taskinfo?taskID=1
|
|||
@mock.patch('koji_cli._unique_path', return_value='random_path')
|
||||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_build_wait(self, watch_tasks_mock, running_in_bg_mock, unique_path_mock,
|
||||
activate_session_mock, stdout):
|
||||
def test_handle_build_wait(
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
unique_path_mock,
|
||||
activate_session_mock,
|
||||
stdout):
|
||||
target = 'target'
|
||||
dest_tag = 'dest_tag'
|
||||
target_info = {'dest_tag': dest_tag}
|
||||
|
|
@ -649,10 +751,13 @@ Task info: weburl/taskinfo?taskID=1
|
|||
unique_path_mock.assert_called_once_with('cli-build')
|
||||
# the second one won't be executed when wait==False
|
||||
self.assertEqual(running_in_bg_mock.call_count, 1)
|
||||
self.session.uploadWrapper.assert_called_once_with(source, 'random_path', callback=cli._progress_callback)
|
||||
self.session.build.assert_called_once_with('random_path/' + source, target, opts, priority=priority)
|
||||
self.session.uploadWrapper.assert_called_once_with(
|
||||
source, 'random_path', callback=cli._progress_callback)
|
||||
self.session.build.assert_called_once_with(
|
||||
'random_path/' + source, target, opts, priority=priority)
|
||||
self.session.logout.assert_called_once()
|
||||
watch_tasks_mock.assert_called_once_with(self.session, [task_id], quiet=self.options.quiet)
|
||||
watch_tasks_mock.assert_called_once_with(
|
||||
self.session, [task_id], quiet=self.options.quiet)
|
||||
self.assertEqual(rv, 0)
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=stringio.StringIO)
|
||||
|
|
@ -660,8 +765,13 @@ Task info: weburl/taskinfo?taskID=1
|
|||
@mock.patch('koji_cli._unique_path', return_value='random_path')
|
||||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_build_nowait(self, watch_tasks_mock, running_in_bg_mock, unique_path_mock,
|
||||
activate_session_mock, stdout):
|
||||
def test_handle_build_nowait(
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
unique_path_mock,
|
||||
activate_session_mock,
|
||||
stdout):
|
||||
target = 'target'
|
||||
dest_tag = 'dest_tag'
|
||||
target_info = {'dest_tag': dest_tag}
|
||||
|
|
@ -693,8 +803,10 @@ Task info: weburl/taskinfo?taskID=1
|
|||
unique_path_mock.assert_called_once_with('cli-build')
|
||||
# the second one won't be executed when wait==False
|
||||
self.assertEqual(running_in_bg_mock.call_count, 1)
|
||||
self.session.uploadWrapper.assert_called_once_with(source, 'random_path', callback=cli._progress_callback)
|
||||
self.session.build.assert_called_once_with('random_path/' + source, target, opts, priority=priority)
|
||||
self.session.uploadWrapper.assert_called_once_with(
|
||||
source, 'random_path', callback=cli._progress_callback)
|
||||
self.session.build.assert_called_once_with(
|
||||
'random_path/' + source, target, opts, priority=priority)
|
||||
self.session.logout.assert_not_called()
|
||||
watch_tasks_mock.assert_not_called()
|
||||
self.assertIsNone(rv)
|
||||
|
|
|
|||
|
|
@ -36,12 +36,24 @@ class TestChainBuild(unittest.TestCase):
|
|||
dest_tag_id = 2
|
||||
build_tag = 'build_tag'
|
||||
build_tag_id = 3
|
||||
target_info = {'dest_tag': dest_tag_id, 'dest_tag_name': dest_tag, 'build_tag': build_tag_id,
|
||||
'build_tag_name': build_tag}
|
||||
target_info = {
|
||||
'dest_tag': dest_tag_id,
|
||||
'dest_tag_name': dest_tag,
|
||||
'build_tag': build_tag_id,
|
||||
'build_tag_name': build_tag}
|
||||
dest_tag_info = {'id': 2, 'name': dest_tag, 'locked': False}
|
||||
tag_tree = [{'parent_id': 2}, {'parent_id': 4}, {'parent_id': 5}]
|
||||
source_args = ['http://scm1', ':', 'http://scm2', 'http://scm3', 'n-v-r-1', ':', 'n-v-r-2', 'n-v-r-3']
|
||||
sources = [['http://scm1'], ['http://scm2', 'http://scm3', 'n-v-r-1'], ['n-v-r-2', 'n-v-r-3']]
|
||||
source_args = [
|
||||
'http://scm1',
|
||||
':',
|
||||
'http://scm2',
|
||||
'http://scm3',
|
||||
'n-v-r-1',
|
||||
':',
|
||||
'n-v-r-2',
|
||||
'n-v-r-3']
|
||||
sources = [['http://scm1'], ['http://scm2',
|
||||
'http://scm3', 'n-v-r-1'], ['n-v-r-2', 'n-v-r-3']]
|
||||
task_id = 1
|
||||
args = [target] + source_args
|
||||
priority = None
|
||||
|
|
@ -64,10 +76,12 @@ Task info: weburl/taskinfo?taskID=1
|
|||
self.session.getBuildTarget.assert_called_once_with(target)
|
||||
self.session.getTag.assert_called_once_with(dest_tag_id, strict=True)
|
||||
self.session.getFullInheritance.assert_called_once_with(build_tag_id)
|
||||
self.session.chainBuild.assert_called_once_with(sources, target, priority=priority)
|
||||
self.session.chainBuild.assert_called_once_with(
|
||||
sources, target, priority=priority)
|
||||
running_in_bg_mock.assert_called_once()
|
||||
self.session.logout.assert_called()
|
||||
watch_tasks_mock.assert_called_once_with(self.session, [task_id], quiet=self.options.quiet)
|
||||
watch_tasks_mock.assert_called_once_with(
|
||||
self.session, [task_id], quiet=self.options.quiet)
|
||||
self.assertEqual(rv, 0)
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=stringio.StringIO)
|
||||
|
|
@ -76,7 +90,12 @@ Task info: weburl/taskinfo?taskID=1
|
|||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_chain_build_no_arg(
|
||||
self, watch_tasks_mock, running_in_bg_mock, activate_session_mock, stderr, stdout):
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
activate_session_mock,
|
||||
stderr,
|
||||
stdout):
|
||||
args = []
|
||||
progname = os.path.basename(sys.argv[0]) or 'koji'
|
||||
|
||||
|
|
@ -111,7 +130,12 @@ Task info: weburl/taskinfo?taskID=1
|
|||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_chain_build_help(
|
||||
self, watch_tasks_mock, running_in_bg_mock, activate_session_mock, stderr, stdout):
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
activate_session_mock,
|
||||
stderr,
|
||||
stdout):
|
||||
args = ['--help']
|
||||
progname = os.path.basename(sys.argv[0]) or 'koji'
|
||||
|
||||
|
|
@ -148,11 +172,23 @@ Options:
|
|||
@mock.patch('koji_cli.activate_session')
|
||||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_chain_build_target_not_found(self, watch_tasks_mock, running_in_bg_mock,
|
||||
activate_session_mock, stderr):
|
||||
def test_handle_chain_build_target_not_found(
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
activate_session_mock,
|
||||
stderr):
|
||||
target = 'target'
|
||||
target_info = None
|
||||
source_args = ['http://scm1', ':', 'http://scm2', 'http://scm3', 'n-v-r-1', ':', 'n-v-r-2', 'n-v-r-3']
|
||||
source_args = [
|
||||
'http://scm1',
|
||||
':',
|
||||
'http://scm2',
|
||||
'http://scm3',
|
||||
'n-v-r-1',
|
||||
':',
|
||||
'n-v-r-2',
|
||||
'n-v-r-3']
|
||||
args = [target] + source_args
|
||||
|
||||
progname = os.path.basename(sys.argv[0]) or 'koji'
|
||||
|
|
@ -185,17 +221,32 @@ Options:
|
|||
@mock.patch('koji_cli.activate_session')
|
||||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_build_dest_tag_locked(self, watch_tasks_mock, running_in_bg_mock,
|
||||
activate_session_mock, stderr):
|
||||
def test_handle_build_dest_tag_locked(
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
activate_session_mock,
|
||||
stderr):
|
||||
target = 'target'
|
||||
dest_tag = 'dest_tag'
|
||||
dest_tag_id = 2
|
||||
build_tag = 'build_tag'
|
||||
build_tag_id = 3
|
||||
target_info = {'dest_tag': dest_tag_id, 'dest_tag_name': dest_tag, 'build_tag': build_tag_id,
|
||||
'build_tag_name': build_tag}
|
||||
target_info = {
|
||||
'dest_tag': dest_tag_id,
|
||||
'dest_tag_name': dest_tag,
|
||||
'build_tag': build_tag_id,
|
||||
'build_tag_name': build_tag}
|
||||
dest_tag_info = {'id': 2, 'name': dest_tag, 'locked': True}
|
||||
source_args = ['http://scm1', ':', 'http://scm2', 'http://scm3', 'n-v-r-1', ':', 'n-v-r-2', 'n-v-r-3']
|
||||
source_args = [
|
||||
'http://scm1',
|
||||
':',
|
||||
'http://scm2',
|
||||
'http://scm3',
|
||||
'n-v-r-1',
|
||||
':',
|
||||
'n-v-r-2',
|
||||
'n-v-r-3']
|
||||
args = [target] + source_args
|
||||
|
||||
progname = os.path.basename(sys.argv[0]) or 'koji'
|
||||
|
|
@ -229,18 +280,30 @@ Options:
|
|||
@mock.patch('koji_cli.activate_session')
|
||||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_build_dest_tag_not_inherited_by_build_tag(self, watch_tasks_mock, running_in_bg_mock,
|
||||
activate_session_mock, stdout):
|
||||
def test_handle_build_dest_tag_not_inherited_by_build_tag(
|
||||
self, watch_tasks_mock, running_in_bg_mock, activate_session_mock, stdout):
|
||||
target = 'target'
|
||||
dest_tag = 'dest_tag'
|
||||
dest_tag_id = 2
|
||||
build_tag = 'build_tag'
|
||||
build_tag_id = 3
|
||||
target_info = {'name': target, 'dest_tag': dest_tag_id, 'dest_tag_name': dest_tag, 'build_tag': build_tag_id,
|
||||
'build_tag_name': build_tag}
|
||||
target_info = {
|
||||
'name': target,
|
||||
'dest_tag': dest_tag_id,
|
||||
'dest_tag_name': dest_tag,
|
||||
'build_tag': build_tag_id,
|
||||
'build_tag_name': build_tag}
|
||||
dest_tag_info = {'id': 2, 'name': dest_tag, 'locked': False}
|
||||
tag_tree = [{'parent_id': 4}, {'parent_id': 5}]
|
||||
source_args = ['http://scm1', ':', 'http://scm2', 'http://scm3', 'n-v-r-1', ':', 'n-v-r-2', 'n-v-r-3']
|
||||
source_args = [
|
||||
'http://scm1',
|
||||
':',
|
||||
'http://scm2',
|
||||
'http://scm3',
|
||||
'n-v-r-1',
|
||||
':',
|
||||
'n-v-r-2',
|
||||
'n-v-r-3']
|
||||
args = [target] + source_args
|
||||
|
||||
self.session.getBuildTarget.return_value = target_info
|
||||
|
|
@ -269,18 +332,32 @@ Target target is not usable for a chain-build
|
|||
@mock.patch('koji_cli.activate_session')
|
||||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_chain_build_invalidated_src(self, watch_tasks_mock, running_in_bg_mock,
|
||||
activate_session_mock):
|
||||
def test_handle_chain_build_invalidated_src(
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
activate_session_mock):
|
||||
target = 'target'
|
||||
dest_tag = 'dest_tag'
|
||||
dest_tag_id = 2
|
||||
build_tag = 'build_tag'
|
||||
build_tag_id = 3
|
||||
target_info = {'dest_tag': dest_tag_id, 'dest_tag_name': dest_tag, 'build_tag': build_tag_id,
|
||||
'build_tag_name': build_tag}
|
||||
target_info = {
|
||||
'dest_tag': dest_tag_id,
|
||||
'dest_tag_name': dest_tag,
|
||||
'build_tag': build_tag_id,
|
||||
'build_tag_name': build_tag}
|
||||
dest_tag_info = {'id': 2, 'name': dest_tag, 'locked': False}
|
||||
tag_tree = [{'parent_id': 2}, {'parent_id': 4}, {'parent_id': 5}]
|
||||
source_args = ['badnvr', ':', 'http://scm2', 'http://scm3', 'n-v-r-1', ':', 'n-v-r-2', 'n-v-r-3']
|
||||
source_args = [
|
||||
'badnvr',
|
||||
':',
|
||||
'http://scm2',
|
||||
'http://scm3',
|
||||
'n-v-r-1',
|
||||
':',
|
||||
'n-v-r-2',
|
||||
'n-v-r-3']
|
||||
args = [target] + source_args
|
||||
|
||||
self.session.getBuildTarget.return_value = target_info
|
||||
|
|
@ -297,8 +374,10 @@ Target target is not usable for a chain-build
|
|||
# Finally, assert that things were called as we expected.
|
||||
activate_session_mock.assert_called_once_with(self.session)
|
||||
self.session.getBuildTarget.assert_called_once_with(target)
|
||||
self.session.getTag.assert_called_once_with(dest_tag_id, strict=True)
|
||||
self.session.getFullInheritance.assert_called_once_with(build_tag_id)
|
||||
self.session.getTag.assert_called_once_with(
|
||||
dest_tag_id, strict=True)
|
||||
self.session.getFullInheritance.assert_called_once_with(
|
||||
build_tag_id)
|
||||
self.session.chainBuild.assert_not_called()
|
||||
running_in_bg_mock.assert_not_called()
|
||||
self.session.logout.assert_not_called()
|
||||
|
|
@ -306,7 +385,15 @@ Target target is not usable for a chain-build
|
|||
self.assertEqual(rv, 1)
|
||||
|
||||
with mock.patch('sys.stdout', new_callable=stringio.StringIO) as stdout:
|
||||
source_args = ['path/n-v-r', ':', 'http://scm2', 'http://scm3', 'n-v-r-1', ':', 'n-v-r-2', 'n-v-r-3']
|
||||
source_args = [
|
||||
'path/n-v-r',
|
||||
':',
|
||||
'http://scm2',
|
||||
'http://scm3',
|
||||
'n-v-r-1',
|
||||
':',
|
||||
'n-v-r-2',
|
||||
'n-v-r-3']
|
||||
args = [target] + source_args
|
||||
# args: target path/n-v-r : http://scm2 http://scm3 n-v-r-1 : n-v-r-2 n-v-r-3
|
||||
# expected: failed
|
||||
|
|
@ -316,7 +403,15 @@ Target target is not usable for a chain-build
|
|||
self.assertMultiLineEqual(actual, expected)
|
||||
|
||||
with mock.patch('sys.stdout', new_callable=stringio.StringIO) as stdout:
|
||||
source_args = ['badn-vr', ':', 'http://scm2', 'http://scm3', 'n-v-r-1', ':', 'n-v-r-2', 'n-v-r-3']
|
||||
source_args = [
|
||||
'badn-vr',
|
||||
':',
|
||||
'http://scm2',
|
||||
'http://scm3',
|
||||
'n-v-r-1',
|
||||
':',
|
||||
'n-v-r-2',
|
||||
'n-v-r-3']
|
||||
args = [target] + source_args
|
||||
# args: target badn-vr : http://scm2 http://scm3 n-v-r-1 : n-v-r-2 n-v-r-3
|
||||
# expected: failed
|
||||
|
|
@ -326,7 +421,15 @@ Target target is not usable for a chain-build
|
|||
self.assertMultiLineEqual(actual, expected)
|
||||
|
||||
with mock.patch('sys.stdout', new_callable=stringio.StringIO) as stdout:
|
||||
source_args = ['badn-v-r.rpm', ':', 'http://scm2', 'http://scm3', 'n-v-r-1', ':', 'n-v-r-2', 'n-v-r-3']
|
||||
source_args = [
|
||||
'badn-v-r.rpm',
|
||||
':',
|
||||
'http://scm2',
|
||||
'http://scm3',
|
||||
'n-v-r-1',
|
||||
':',
|
||||
'n-v-r-2',
|
||||
'n-v-r-3']
|
||||
args = [target] + source_args
|
||||
# args: target badn-v-r.rpm : http://scm2 http://scm3 n-v-r-1 : n-v-r-2 n-v-r-3
|
||||
# expected: failed
|
||||
|
|
@ -359,19 +462,35 @@ If there are no dependencies, use the build command instead
|
|||
@mock.patch('koji_cli.activate_session')
|
||||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_chain_build_background(self, watch_tasks_mock, running_in_bg_mock,
|
||||
activate_session_mock, stdout):
|
||||
def test_handle_chain_build_background(
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
activate_session_mock,
|
||||
stdout):
|
||||
target = 'target'
|
||||
dest_tag = 'dest_tag'
|
||||
dest_tag_id = 2
|
||||
build_tag = 'build_tag'
|
||||
build_tag_id = 3
|
||||
target_info = {'dest_tag': dest_tag_id, 'dest_tag_name': dest_tag, 'build_tag': build_tag_id,
|
||||
'build_tag_name': build_tag}
|
||||
target_info = {
|
||||
'dest_tag': dest_tag_id,
|
||||
'dest_tag_name': dest_tag,
|
||||
'build_tag': build_tag_id,
|
||||
'build_tag_name': build_tag}
|
||||
dest_tag_info = {'id': 2, 'name': dest_tag, 'locked': False}
|
||||
tag_tree = [{'parent_id': 2}, {'parent_id': 4}, {'parent_id': 5}]
|
||||
source_args = ['http://scm1', ':', 'http://scm2', 'http://scm3', 'n-v-r-1', ':', 'n-v-r-2', 'n-v-r-3']
|
||||
sources = [['http://scm1'], ['http://scm2', 'http://scm3', 'n-v-r-1'], ['n-v-r-2', 'n-v-r-3']]
|
||||
source_args = [
|
||||
'http://scm1',
|
||||
':',
|
||||
'http://scm2',
|
||||
'http://scm3',
|
||||
'n-v-r-1',
|
||||
':',
|
||||
'n-v-r-2',
|
||||
'n-v-r-3']
|
||||
sources = [['http://scm1'], ['http://scm2',
|
||||
'http://scm3', 'n-v-r-1'], ['n-v-r-2', 'n-v-r-3']]
|
||||
task_id = 1
|
||||
args = ['--background', target] + source_args
|
||||
priority = 5
|
||||
|
|
@ -394,29 +513,47 @@ Task info: weburl/taskinfo?taskID=1
|
|||
self.session.getBuildTarget.assert_called_once_with(target)
|
||||
self.session.getTag.assert_called_once_with(dest_tag_id, strict=True)
|
||||
self.session.getFullInheritance.assert_called_once_with(build_tag_id)
|
||||
self.session.chainBuild.assert_called_once_with(sources, target, priority=priority)
|
||||
self.session.chainBuild.assert_called_once_with(
|
||||
sources, target, priority=priority)
|
||||
running_in_bg_mock.assert_called_once()
|
||||
self.session.logout.assert_called()
|
||||
watch_tasks_mock.assert_called_once_with(self.session, [task_id], quiet=self.options.quiet)
|
||||
watch_tasks_mock.assert_called_once_with(
|
||||
self.session, [task_id], quiet=self.options.quiet)
|
||||
self.assertEqual(rv, 0)
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=stringio.StringIO)
|
||||
@mock.patch('koji_cli.activate_session')
|
||||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_chain_build_quiet(self, watch_tasks_mock, running_in_bg_mock,
|
||||
activate_session_mock, stdout):
|
||||
def test_handle_chain_build_quiet(
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
activate_session_mock,
|
||||
stdout):
|
||||
target = 'target'
|
||||
dest_tag = 'dest_tag'
|
||||
dest_tag_id = 2
|
||||
build_tag = 'build_tag'
|
||||
build_tag_id = 3
|
||||
target_info = {'dest_tag': dest_tag_id, 'dest_tag_name': dest_tag, 'build_tag': build_tag_id,
|
||||
'build_tag_name': build_tag}
|
||||
target_info = {
|
||||
'dest_tag': dest_tag_id,
|
||||
'dest_tag_name': dest_tag,
|
||||
'build_tag': build_tag_id,
|
||||
'build_tag_name': build_tag}
|
||||
dest_tag_info = {'id': 2, 'name': dest_tag, 'locked': False}
|
||||
tag_tree = [{'parent_id': 2}, {'parent_id': 4}, {'parent_id': 5}]
|
||||
source_args = ['http://scm1', ':', 'http://scm2', 'http://scm3', 'n-v-r-1', ':', 'n-v-r-2', 'n-v-r-3']
|
||||
sources = [['http://scm1'], ['http://scm2', 'http://scm3', 'n-v-r-1'], ['n-v-r-2', 'n-v-r-3']]
|
||||
source_args = [
|
||||
'http://scm1',
|
||||
':',
|
||||
'http://scm2',
|
||||
'http://scm3',
|
||||
'n-v-r-1',
|
||||
':',
|
||||
'n-v-r-2',
|
||||
'n-v-r-3']
|
||||
sources = [['http://scm1'], ['http://scm2',
|
||||
'http://scm3', 'n-v-r-1'], ['n-v-r-2', 'n-v-r-3']]
|
||||
task_id = 1
|
||||
self.options.quiet = True
|
||||
args = ['--quiet', target] + source_args
|
||||
|
|
@ -438,29 +575,47 @@ Task info: weburl/taskinfo?taskID=1
|
|||
self.session.getBuildTarget.assert_called_once_with(target)
|
||||
self.session.getTag.assert_called_once_with(dest_tag_id, strict=True)
|
||||
self.session.getFullInheritance.assert_called_once_with(build_tag_id)
|
||||
self.session.chainBuild.assert_called_once_with(sources, target, priority=priority)
|
||||
self.session.chainBuild.assert_called_once_with(
|
||||
sources, target, priority=priority)
|
||||
running_in_bg_mock.assert_called_once()
|
||||
self.session.logout.assert_called()
|
||||
watch_tasks_mock.assert_called_once_with(self.session, [task_id], quiet=self.options.quiet)
|
||||
watch_tasks_mock.assert_called_once_with(
|
||||
self.session, [task_id], quiet=self.options.quiet)
|
||||
self.assertEqual(rv, 0)
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=stringio.StringIO)
|
||||
@mock.patch('koji_cli.activate_session')
|
||||
@mock.patch('koji_cli._running_in_bg', return_value=True)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_chain_build_running_in_bg(self, watch_tasks_mock, running_in_bg_mock,
|
||||
activate_session_mock, stdout):
|
||||
def test_handle_chain_build_running_in_bg(
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
activate_session_mock,
|
||||
stdout):
|
||||
target = 'target'
|
||||
dest_tag = 'dest_tag'
|
||||
dest_tag_id = 2
|
||||
build_tag = 'build_tag'
|
||||
build_tag_id = 3
|
||||
target_info = {'dest_tag': dest_tag_id, 'dest_tag_name': dest_tag, 'build_tag': build_tag_id,
|
||||
'build_tag_name': build_tag}
|
||||
target_info = {
|
||||
'dest_tag': dest_tag_id,
|
||||
'dest_tag_name': dest_tag,
|
||||
'build_tag': build_tag_id,
|
||||
'build_tag_name': build_tag}
|
||||
dest_tag_info = {'id': 2, 'name': dest_tag, 'locked': False}
|
||||
tag_tree = [{'parent_id': 2}, {'parent_id': 4}, {'parent_id': 5}]
|
||||
source_args = ['http://scm1', ':', 'http://scm2', 'http://scm3', 'n-v-r-1', ':', 'n-v-r-2', 'n-v-r-3']
|
||||
sources = [['http://scm1'], ['http://scm2', 'http://scm3', 'n-v-r-1'], ['n-v-r-2', 'n-v-r-3']]
|
||||
source_args = [
|
||||
'http://scm1',
|
||||
':',
|
||||
'http://scm2',
|
||||
'http://scm3',
|
||||
'n-v-r-1',
|
||||
':',
|
||||
'n-v-r-2',
|
||||
'n-v-r-3']
|
||||
sources = [['http://scm1'], ['http://scm2',
|
||||
'http://scm3', 'n-v-r-1'], ['n-v-r-2', 'n-v-r-3']]
|
||||
task_id = 1
|
||||
args = [target] + source_args
|
||||
priority = None
|
||||
|
|
@ -483,7 +638,8 @@ Task info: weburl/taskinfo?taskID=1
|
|||
self.session.getBuildTarget.assert_called_once_with(target)
|
||||
self.session.getTag.assert_called_once_with(dest_tag_id, strict=True)
|
||||
self.session.getFullInheritance.assert_called_once_with(build_tag_id)
|
||||
self.session.chainBuild.assert_called_once_with(sources, target, priority=priority)
|
||||
self.session.chainBuild.assert_called_once_with(
|
||||
sources, target, priority=priority)
|
||||
running_in_bg_mock.assert_called_once()
|
||||
self.session.logout.assert_not_called()
|
||||
watch_tasks_mock.assert_not_called()
|
||||
|
|
@ -493,19 +649,35 @@ Task info: weburl/taskinfo?taskID=1
|
|||
@mock.patch('koji_cli.activate_session')
|
||||
@mock.patch('koji_cli._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.watch_tasks', return_value=0)
|
||||
def test_handle_chain_build_nowait(self, watch_tasks_mock, running_in_bg_mock,
|
||||
activate_session_mock, stdout):
|
||||
def test_handle_chain_build_nowait(
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
activate_session_mock,
|
||||
stdout):
|
||||
target = 'target'
|
||||
dest_tag = 'dest_tag'
|
||||
dest_tag_id = 2
|
||||
build_tag = 'build_tag'
|
||||
build_tag_id = 3
|
||||
target_info = {'dest_tag': dest_tag_id, 'dest_tag_name': dest_tag, 'build_tag': build_tag_id,
|
||||
'build_tag_name': build_tag}
|
||||
target_info = {
|
||||
'dest_tag': dest_tag_id,
|
||||
'dest_tag_name': dest_tag,
|
||||
'build_tag': build_tag_id,
|
||||
'build_tag_name': build_tag}
|
||||
dest_tag_info = {'id': 2, 'name': dest_tag, 'locked': False}
|
||||
tag_tree = [{'parent_id': 2}, {'parent_id': 4}, {'parent_id': 5}]
|
||||
source_args = ['http://scm1', ':', 'http://scm2', 'http://scm3', 'n-v-r-1', ':', 'n-v-r-2', 'n-v-r-3']
|
||||
sources = [['http://scm1'], ['http://scm2', 'http://scm3', 'n-v-r-1'], ['n-v-r-2', 'n-v-r-3']]
|
||||
source_args = [
|
||||
'http://scm1',
|
||||
':',
|
||||
'http://scm2',
|
||||
'http://scm3',
|
||||
'n-v-r-1',
|
||||
':',
|
||||
'n-v-r-2',
|
||||
'n-v-r-3']
|
||||
sources = [['http://scm1'], ['http://scm2',
|
||||
'http://scm3', 'n-v-r-1'], ['n-v-r-2', 'n-v-r-3']]
|
||||
task_id = 1
|
||||
args = ['--nowait', target] + source_args
|
||||
priority = None
|
||||
|
|
@ -528,7 +700,8 @@ Task info: weburl/taskinfo?taskID=1
|
|||
self.session.getBuildTarget.assert_called_once_with(target)
|
||||
self.session.getTag.assert_called_once_with(dest_tag_id, strict=True)
|
||||
self.session.getFullInheritance.assert_called_once_with(build_tag_id)
|
||||
self.session.chainBuild.assert_called_once_with(sources, target, priority=priority)
|
||||
self.session.chainBuild.assert_called_once_with(
|
||||
sources, target, priority=priority)
|
||||
running_in_bg_mock.assert_called_once()
|
||||
self.session.logout.assert_not_called()
|
||||
watch_tasks_mock.assert_not_called()
|
||||
|
|
|
|||
|
|
@ -351,12 +351,20 @@ def generate_out_calls():
|
|||
comps_file = path + '/data/comps-example.xml'
|
||||
stdout_file = path + '/data/comps-example.yumcomps.out'
|
||||
calls_file = path + '/data/comps-example.yumcomps.calls'
|
||||
_generate_out_calls(cli._import_comps_alt, comps_file, stdout_file, calls_file)
|
||||
_generate_out_calls(
|
||||
cli._import_comps_alt,
|
||||
comps_file,
|
||||
stdout_file,
|
||||
calls_file)
|
||||
|
||||
comps_file = path + '/data/comps-sample.xml'
|
||||
stdout_file = path + '/data/comps-sample.yumcomps.out'
|
||||
calls_file = path + '/data/comps-sample.yumcomps.calls'
|
||||
_generate_out_calls(cli._import_comps_alt, comps_file, stdout_file, calls_file)
|
||||
_generate_out_calls(
|
||||
cli._import_comps_alt,
|
||||
comps_file,
|
||||
stdout_file,
|
||||
calls_file)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ cli = loadcli.cli
|
|||
|
||||
|
||||
class TestRunningInBg(unittest.TestCase):
|
||||
|
||||
@mock.patch('koji_cli.os')
|
||||
def test_running_in_bg(self, os_mock):
|
||||
os_mock.isatty.return_value = False
|
||||
|
|
|
|||
|
|
@ -9,8 +9,12 @@ class TestUniquePath(unittest.TestCase):
|
|||
|
||||
def test_unique_path(self):
|
||||
for i in range(1000):
|
||||
self.assertNotEqual(cli._unique_path('prefix'), cli._unique_path('prefix'))
|
||||
self.assertRegexpMatches(cli._unique_path('prefix'), '^prefix/\d{10}\.\d{1,6}\.[a-zA-Z]{8}$')
|
||||
self.assertNotEqual(
|
||||
cli._unique_path('prefix'),
|
||||
cli._unique_path('prefix'))
|
||||
self.assertRegexpMatches(
|
||||
cli._unique_path('prefix'),
|
||||
'^prefix/\d{10}\.\d{1,6}\.[a-zA-Z]{8}$')
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
|||
|
|
@ -35,10 +35,11 @@ class TestUploadProgressCallBack(unittest.TestCase):
|
|||
cli._progress_callback(12300, 234000, 5670, 80, 900)
|
||||
cli._progress_callback(45600, 234000, 5670, 0, 900)
|
||||
cli._progress_callback(234000, 234000, 5670, 80, 900)
|
||||
self.assertMultiLineEqual(stdout.getvalue(),
|
||||
'[= ] 05% 00:15:00 12.01 KiB 70.88 B/sec\r'
|
||||
'[======= ] 19% 00:15:00 44.53 KiB - B/sec\r'
|
||||
'[====================================] 100% 00:15:00 228.52 KiB 260.00 B/sec\r')
|
||||
self.assertMultiLineEqual(
|
||||
stdout.getvalue(),
|
||||
'[= ] 05% 00:15:00 12.01 KiB 70.88 B/sec\r'
|
||||
'[======= ] 19% 00:15:00 44.53 KiB - B/sec\r'
|
||||
'[====================================] 100% 00:15:00 228.52 KiB 260.00 B/sec\r')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue