PR#1785: unify return values for permission denied
Merges #1785 https://pagure.io/koji/pull-request/1785 Fixes: #1784 https://pagure.io/koji/issue/1784 Unify error messages in CLI Fixes: #1776 https://pagure.io/koji/issue/1776 Return code 1 for add-tag, remove-tag, edit-target, remove-target without tag and admin permissions
This commit is contained in:
commit
d7226b1681
53 changed files with 404 additions and 664 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -100,6 +100,9 @@ Available categories are: %(categories)s
|
|||
return _(epilog_str)
|
||||
|
||||
|
||||
def get_usage_str(usage):
|
||||
return usage + _("\n(Specify the --help global option for a list of other help options)")
|
||||
|
||||
def ensure_connection(session):
|
||||
try:
|
||||
ret = session.getAPIVersion()
|
||||
|
|
|
|||
|
|
@ -1,21 +1,27 @@
|
|||
from __future__ import absolute_import
|
||||
|
||||
import mock
|
||||
import os
|
||||
import six
|
||||
import sys
|
||||
try:
|
||||
import unittest2 as unittest
|
||||
except ImportError:
|
||||
import unittest
|
||||
|
||||
from koji_cli.commands import handle_add_group
|
||||
from . import utils
|
||||
|
||||
class TestAddGroup(unittest.TestCase):
|
||||
class TestAddGroup(utils.CliTestCase):
|
||||
|
||||
# Show long diffs in error output...
|
||||
maxDiff = None
|
||||
|
||||
def setUp(self):
|
||||
self.error_format = """Usage: %s add-group <tag> <group>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
@mock.patch('koji_cli.commands.activate_session')
|
||||
def test_handle_add_group(self, activate_session_mock, stdout):
|
||||
|
|
@ -89,19 +95,13 @@ class TestAddGroup(unittest.TestCase):
|
|||
session = mock.MagicMock()
|
||||
|
||||
# Run it and check immediate output
|
||||
with self.assertRaises(SystemExit) as cm:
|
||||
rv = handle_add_group(options, session, arguments)
|
||||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = ''
|
||||
progname = os.path.basename(sys.argv[0]) or 'koji'
|
||||
expected_stderr = """Usage: %s add-group <tag> <group>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Please specify a tag name and a group name
|
||||
""" % (progname, progname)
|
||||
self.assertMultiLineEqual(actual_stdout, expected_stdout)
|
||||
self.assertMultiLineEqual(actual_stderr, expected_stderr)
|
||||
self.assert_system_exit(
|
||||
handle_add_group,
|
||||
options, session, arguments,
|
||||
stdout='',
|
||||
stderr=self.format_error_message("Please specify a tag name and a group name"),
|
||||
exit_code=2,
|
||||
activate_session=None)
|
||||
|
||||
# Finally, assert that things were called as we expected.
|
||||
activate_session_mock.assert_not_called()
|
||||
|
|
@ -109,10 +109,6 @@ class TestAddGroup(unittest.TestCase):
|
|||
session.getTag.assert_not_called()
|
||||
session.getTagGroups.assert_not_called()
|
||||
session.groupListAdd.assert_not_called()
|
||||
if isinstance(cm.exception, int):
|
||||
self.assertEqual(cm.exception, 2)
|
||||
else:
|
||||
self.assertEqual(cm.exception.code, 2)
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
@mock.patch('koji_cli.commands.activate_session')
|
||||
|
|
@ -127,10 +123,13 @@ class TestAddGroup(unittest.TestCase):
|
|||
session.hasPerm.return_value = False
|
||||
|
||||
# Run it and check immediate output
|
||||
rv = handle_add_group(options, session, arguments)
|
||||
actual = stdout.getvalue()
|
||||
expected = 'This action requires tag or admin privileges\n'
|
||||
self.assertMultiLineEqual(actual, expected)
|
||||
self.assert_system_exit(
|
||||
handle_add_group,
|
||||
options, session, arguments,
|
||||
stdout='',
|
||||
stderr=self.format_error_message('This action requires tag or admin privileges'),
|
||||
activate_session=None,
|
||||
exit_code=2)
|
||||
|
||||
# Finally, assert that things were called as we expected.
|
||||
activate_session_mock.assert_called_once_with(session, options)
|
||||
|
|
@ -139,7 +138,6 @@ class TestAddGroup(unittest.TestCase):
|
|||
session.getTag.assert_not_called()
|
||||
session.getTagGroups.assert_not_called()
|
||||
session.groupListAdd.assert_not_called()
|
||||
self.assertEqual(rv, 1)
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
@mock.patch('koji_cli.commands.activate_session')
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class TestAddGroupPkg(utils.CliTestCase):
|
|||
self.options = mock.MagicMock()
|
||||
self.activate_session = mock.patch('koji_cli.commands.activate_session').start()
|
||||
|
||||
self.error_format = """Usage: %s add-group-pkg [options] <tag> <group> <pkg> [<pkg>...]
|
||||
self.error_format = """Usage: %s add-group-pkg [options] <tag> <group> <pkg> [<pkg> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -54,7 +54,7 @@ class TestAddGroupPkg(utils.CliTestCase):
|
|||
def test_handle_add_group_pkg_help(self):
|
||||
self.assert_help(
|
||||
handle_add_group_pkg,
|
||||
"""Usage: %s add-group-pkg [options] <tag> <group> <pkg> [<pkg>...]
|
||||
"""Usage: %s add-group-pkg [options] <tag> <group> <pkg> [<pkg> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ class TestAddHost(unittest.TestCase):
|
|||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = ''
|
||||
expected_stderr = """Usage: %s add-host [options] hostname arch [arch2 ...]
|
||||
expected_stderr = """Usage: %s add-host [options] <hostname> <arch> [<arch> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Please specify a hostname and at least one arch
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ class TestAddHostToChannel(unittest.TestCase):
|
|||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = ''
|
||||
expected_stderr = """Usage: %s add-host-to-channel [options] hostname channel
|
||||
expected_stderr = """Usage: %s add-host-to-channel [options] <hostname> <channel>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Please specify a hostname and a channel
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ class TestAddPkg(unittest.TestCase):
|
|||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = ''
|
||||
expected_stderr = """Usage: %s add-pkg [options] tag package [package2 ...]
|
||||
expected_stderr = """Usage: %s add-pkg [options] <tag> <package> [<package> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Please specify an owner for the package(s)
|
||||
|
|
@ -239,7 +239,7 @@ class TestAddPkg(unittest.TestCase):
|
|||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = ''
|
||||
expected_stderr = """Usage: %s add-pkg [options] tag package [package2 ...]
|
||||
expected_stderr = """Usage: %s add-pkg [options] <tag> <package> [<package> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Please specify a tag and at least one package
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class TestAddTag(utils.CliTestCase):
|
|||
maxDiff = None
|
||||
|
||||
def setUp(self):
|
||||
self.error_format = """Usage: %s add-tag [options] name
|
||||
self.error_format = """Usage: %s add-tag [options] <name>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -44,10 +44,13 @@ class TestAddTag(utils.CliTestCase):
|
|||
activate_session=None)
|
||||
|
||||
# Case 2. not admin account
|
||||
expected = "This action requires tag or admin privileges\n"
|
||||
session.hasPerm.return_value = None
|
||||
handle_add_tag(options, session, ['test-tag'])
|
||||
self.assert_console_message(stdout, expected)
|
||||
self.assert_system_exit(
|
||||
handle_add_tag,
|
||||
options, session, ['test-tag'],
|
||||
stdout='',
|
||||
stderr=self.format_error_message("This action requires tag or admin privileges"),
|
||||
)
|
||||
|
||||
# Case 3. options test
|
||||
arguments = ['test-tag',
|
||||
|
|
@ -77,7 +80,7 @@ class TestAddTag(utils.CliTestCase):
|
|||
def test_handle_add_tag_help(self):
|
||||
self.assert_help(
|
||||
handle_add_tag,
|
||||
"""Usage: %s add-tag [options] name
|
||||
"""Usage: %s add-tag [options] <name>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class TestAddUser(utils.CliTestCase):
|
|||
maxDiff = None
|
||||
|
||||
def setUp(self):
|
||||
self.error_format = """Usage: %s add-user username [options]
|
||||
self.error_format = """Usage: %s add-user <username> [options]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -82,7 +82,7 @@ class TestAddUser(utils.CliTestCase):
|
|||
def test_handle_add_user_help(self):
|
||||
self.assert_help(
|
||||
handle_add_user,
|
||||
"""Usage: %s add-user username [options]
|
||||
"""Usage: %s add-user <username> [options]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class TestAddVolume(utils.CliTestCase):
|
|||
maxDiff = None
|
||||
|
||||
def setUp(self):
|
||||
self.error_format = """Usage: %s add-volume volume-name
|
||||
self.error_format = """Usage: %s add-volume <volume-name>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -66,7 +66,7 @@ class TestAddVolume(utils.CliTestCase):
|
|||
def test_handle_add_volume_help(self):
|
||||
self.assert_help(
|
||||
handle_add_volume,
|
||||
"""Usage: %s add-volume volume-name
|
||||
"""Usage: %s add-volume <volume-name>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -10,13 +10,21 @@ except ImportError:
|
|||
|
||||
import koji
|
||||
from koji_cli.commands import handle_assign_task
|
||||
from . import utils
|
||||
|
||||
|
||||
class TestAssignTask(unittest.TestCase):
|
||||
class TestAssignTask(utils.CliTestCase):
|
||||
|
||||
# Show long diffs in error output...
|
||||
maxDiff = None
|
||||
|
||||
def setUp(self):
|
||||
self.error_format = """Usage: %s assign-task <task_id> <hostname>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
@mock.patch('koji_cli.commands.activate_session')
|
||||
def test_handle_assign_task(
|
||||
|
|
@ -43,10 +51,11 @@ class TestAssignTask(unittest.TestCase):
|
|||
arguments.append("--force")
|
||||
session.getHost.return_value = hostname
|
||||
session.hasPerm.return_value = False
|
||||
handle_assign_task(options, session, arguments)
|
||||
actual = stdout.getvalue()
|
||||
expected = "This action requires admin privileges\n"
|
||||
self.assertMultiLineEqual(actual, expected)
|
||||
self.assert_system_exit(
|
||||
handle_assign_task,
|
||||
options, session, arguments,
|
||||
stderr=self.format_error_message("This action requires admin privileges")
|
||||
)
|
||||
|
||||
# Clean stdout buffer
|
||||
stdout.truncate(0)
|
||||
|
|
@ -82,33 +91,24 @@ class TestAssignTask(unittest.TestCase):
|
|||
self, activate_session_mock, stderr, stdout):
|
||||
arguments = []
|
||||
options = mock.MagicMock()
|
||||
progname = os.path.basename(sys.argv[0]) or 'koji'
|
||||
|
||||
# Mock out the xmlrpc server
|
||||
session = mock.MagicMock()
|
||||
|
||||
# Run it and check immediate output
|
||||
with self.assertRaises(SystemExit) as cm:
|
||||
handle_assign_task(options, session, arguments)
|
||||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = ''
|
||||
expected_stderr = """Usage: %s assign-task task_id hostname
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: please specify a task id and a hostname
|
||||
""" % (progname, progname)
|
||||
self.assertMultiLineEqual(actual_stdout, expected_stdout)
|
||||
self.assertMultiLineEqual(actual_stderr, expected_stderr)
|
||||
self.assert_system_exit(
|
||||
handle_assign_task,
|
||||
options, session, arguments,
|
||||
stdout='',
|
||||
stderr=self.format_error_message('please specify a task id and a hostname'),
|
||||
activate_session=None,
|
||||
exit_code=2
|
||||
)
|
||||
|
||||
# Finally, assert that things were called as we expected.
|
||||
activate_session_mock.assert_not_called()
|
||||
session.hasHost.assert_not_called()
|
||||
session.addHost.assert_not_called()
|
||||
if isinstance(cm.exception, int):
|
||||
self.assertEqual(cm.exception, 2)
|
||||
else:
|
||||
self.assertEqual(cm.exception.code, 2)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
|
|
@ -117,12 +117,16 @@ class TestBlockGroup(utils.CliTestCase):
|
|||
session,
|
||||
args,
|
||||
stderr=expected,
|
||||
activate_session=None)
|
||||
activate_session=None,
|
||||
exit_code=2)
|
||||
|
||||
# if we don't have 'admin' permission
|
||||
session.hasPerm.return_value = False
|
||||
rv = handle_block_group(options, session, ['tag', 'grp'])
|
||||
self.assert_console_message(
|
||||
stdout, 'This action requires tag or admin privileges\n')
|
||||
self.assertEqual(rv, 1)
|
||||
self.assert_system_exit(
|
||||
handle_block_group,
|
||||
options, session, ['tag', 'grp'],
|
||||
stderr=self.format_error_message('This action requires tag or admin privileges'),
|
||||
stdout='',
|
||||
exit_code=2,
|
||||
activate_session=None)
|
||||
activate_session_mock.assert_called_with(session, options)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class TestBlockGroupPkg(utils.CliTestCase):
|
|||
self.options = mock.MagicMock()
|
||||
self.activate_session = mock.patch('koji_cli.commands.activate_session').start()
|
||||
|
||||
self.error_format = """Usage: %s block-group-pkg [options] <tag> <group> <pkg> [<pkg>...]
|
||||
self.error_format = """Usage: %s block-group-pkg [options] <tag> <group> <pkg> [<pkg> ...]
|
||||
Note that blocking is propagated through the inheritance chain, so it is not exactly the same as package removal.
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ Note that blocking is propagated through the inheritance chain, so it is not exa
|
|||
def test_handle_block_group_pkg_help(self):
|
||||
self.assert_help(
|
||||
handle_block_group_pkg,
|
||||
"""Usage: %s block-group-pkg [options] <tag> <group> <pkg> [<pkg>...]
|
||||
"""Usage: %s block-group-pkg [options] <tag> <group> <pkg> [<pkg> ...]
|
||||
Note that blocking is propagated through the inheritance chain, so it is not exactly the same as package removal.
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ class TestBlockPkg(unittest.TestCase):
|
|||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = ''
|
||||
expected_stderr = """Usage: %s block-pkg [options] tag package [package2 ...]
|
||||
expected_stderr = """Usage: %s block-pkg [options] <tag> <package> [<package> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Please specify a tag and at least one package
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ Task info: weburl/taskinfo?taskID=1
|
|||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = ''
|
||||
expected_stderr = """Usage: %s build [options] target <srpm path or scm url>
|
||||
expected_stderr = """Usage: %s build [options] <target> <srpm path or scm url>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Exactly two arguments (a build target and a SCM URL or srpm file) are required
|
||||
|
|
@ -192,7 +192,7 @@ Task info: weburl/taskinfo?taskID=1
|
|||
handle_build(self.options, self.session, args)
|
||||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = """Usage: %s build [options] target <srpm path or scm url>
|
||||
expected_stdout = """Usage: %s build [options] <target> <srpm path or scm url>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
@ -255,7 +255,7 @@ Options:
|
|||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = ''
|
||||
expected_stderr = """Usage: %s build [options] target <srpm path or scm url>
|
||||
expected_stderr = """Usage: %s build [options] <target> <srpm path or scm url>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: --arch_override is only allowed for --scratch builds
|
||||
|
|
@ -350,7 +350,7 @@ Task info: weburl/taskinfo?taskID=1
|
|||
with self.assertRaises(SystemExit) as cm:
|
||||
handle_build(self.options, self.session, args)
|
||||
actual = stderr.getvalue()
|
||||
expected = """Usage: %s build [options] target <srpm path or scm url>
|
||||
expected = """Usage: %s build [options] <target> <srpm path or scm url>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Unknown build target: target
|
||||
|
|
@ -401,7 +401,7 @@ Task info: weburl/taskinfo?taskID=1
|
|||
with self.assertRaises(SystemExit) as cm:
|
||||
handle_build(self.options, self.session, args)
|
||||
actual = stderr.getvalue()
|
||||
expected = """Usage: %s build [options] target <srpm path or scm url>
|
||||
expected = """Usage: %s build [options] <target> <srpm path or scm url>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Unknown destination tag: dest_tag_name
|
||||
|
|
@ -452,7 +452,7 @@ Task info: weburl/taskinfo?taskID=1
|
|||
with self.assertRaises(SystemExit) as cm:
|
||||
handle_build(self.options, self.session, args)
|
||||
actual = stderr.getvalue()
|
||||
expected = """Usage: %s build [options] target <srpm path or scm url>
|
||||
expected = """Usage: %s build [options] <target> <srpm path or scm url>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Destination tag dest_tag_name is locked
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class TestCall(utils.CliTestCase):
|
|||
maxDiff = None
|
||||
|
||||
def setUp(self):
|
||||
self.error_format = """Usage: %s call [options] name [arg...]
|
||||
self.error_format = """Usage: %s call [options] <name> [<arg> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -136,7 +136,7 @@ class TestCall(utils.CliTestCase):
|
|||
"""Test handle_call help message"""
|
||||
self.assert_help(
|
||||
handle_call,
|
||||
"""Usage: %s call [options] name [arg...]
|
||||
"""Usage: %s call [options] <name> [<arg> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ Task info: weburl/taskinfo?taskID=1
|
|||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = ''
|
||||
expected_stderr = """Usage: %s chain-build [options] target URL [URL2 [:] URL3 [:] URL4 ...]
|
||||
expected_stderr = """Usage: %s chain-build [options] <target> <URL> [<URL> [:] <URL> [:] <URL> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: At least two arguments (a build target and a SCM URL) are required
|
||||
|
|
@ -147,7 +147,7 @@ Task info: weburl/taskinfo?taskID=1
|
|||
handle_chain_build(self.options, self.session, args)
|
||||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = """Usage: %s chain-build [options] target URL [URL2 [:] URL3 [:] URL4 ...]
|
||||
expected_stdout = """Usage: %s chain-build [options] <target> <URL> [<URL> [:] <URL> [:] <URL> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
@ -206,7 +206,7 @@ Options:
|
|||
with self.assertRaises(SystemExit) as cm:
|
||||
handle_chain_build(self.options, self.session, args)
|
||||
actual = stderr.getvalue()
|
||||
expected = """Usage: %s chain-build [options] target URL [URL2 [:] URL3 [:] URL4 ...]
|
||||
expected = """Usage: %s chain-build [options] <target> <URL> [<URL> [:] <URL> [:] <URL> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Unknown build target: target
|
||||
|
|
@ -268,7 +268,7 @@ Options:
|
|||
with self.assertRaises(SystemExit) as cm:
|
||||
handle_chain_build(self.options, self.session, args)
|
||||
actual = stderr.getvalue()
|
||||
expected = """Usage: %s chain-build [options] target URL [URL2 [:] URL3 [:] URL4 ...]
|
||||
expected = """Usage: %s chain-build [options] <target> <URL> [<URL> [:] <URL> [:] <URL> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Destination tag dest_tag is locked
|
||||
|
|
@ -461,7 +461,7 @@ Target target is not usable for a chain-build
|
|||
with self.assertRaises(SystemExit) as cm:
|
||||
handle_chain_build(self.options, self.session, args)
|
||||
actual = stderr.getvalue()
|
||||
expected = """Usage: %s chain-build [options] target URL [URL2 [:] URL3 [:] URL4 ...]
|
||||
expected = """Usage: %s chain-build [options] <target> <URL> [<URL> [:] <URL> [:] <URL> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: You must specify at least one dependency between builds with : (colon)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class TestDisableHost(utils.CliTestCase):
|
|||
maxDiff = None
|
||||
|
||||
def setUp(self):
|
||||
self.error_format = """Usage: %s disable-host [options] hostname ...
|
||||
self.error_format = """Usage: %s disable-host [options] <hostname> [<hostname> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -123,7 +123,7 @@ class TestDisableHost(utils.CliTestCase):
|
|||
"""Test %s help message""" % handle_disable_host.__name__
|
||||
self.assert_help(
|
||||
handle_disable_host,
|
||||
"""Usage: %s disable-host [options] hostname ...
|
||||
"""Usage: %s disable-host [options] <hostname> [<hostname> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class TestDisableUser(utils.CliTestCase):
|
|||
maxDiff = None
|
||||
|
||||
def setUp(self):
|
||||
self.error_format = """Usage: %s disable-user username
|
||||
self.error_format = """Usage: %s disable-user <username>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -63,7 +63,7 @@ class TestDisableUser(utils.CliTestCase):
|
|||
def test_handle_disable_user_help(self):
|
||||
self.assert_help(
|
||||
handle_disable_user,
|
||||
"""Usage: %s disable-user username
|
||||
"""Usage: %s disable-user <username>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ class TestDistRepo(utils.CliTestCase):
|
|||
self.session.getTag.return_value = copy.deepcopy(self.TAG)
|
||||
self.session.distRepo.return_value = self.task_id
|
||||
|
||||
self.error_format = """Usage: %s dist-repo [options] tag keyID [keyID...]
|
||||
(Specify the --help option for a list of other options)
|
||||
self.error_format = """Usage: %s dist-repo [options] <tag> <key_id> [<key_id> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
|
@ -248,8 +248,8 @@ class TestDistRepo(utils.CliTestCase):
|
|||
"""Test handle_dist_repo help message"""
|
||||
self.assert_help(
|
||||
handle_dist_repo,
|
||||
"""Usage: %s dist-repo [options] tag keyID [keyID...]
|
||||
(Specify the --help option for a list of other options)
|
||||
"""Usage: %s dist-repo [options] <tag> <key_id> [<key_id> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
-h, --help show this help message and exit
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ class TestEditHost(unittest.TestCase):
|
|||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = ''
|
||||
expected_stderr = """Usage: %s edit-host hostname ... [options]
|
||||
expected_stderr = """Usage: %s edit-host <hostname> [<hostname> ...] [options]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Please specify a hostname
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ class TestEditTag(unittest.TestCase):
|
|||
handle_edit_tag(options, session, args)
|
||||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = """Usage: %s edit-tag [options] name
|
||||
expected_stdout = """Usage: %s edit-tag [options] <name>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
@ -162,7 +162,7 @@ Options:
|
|||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = ''
|
||||
expected_stderr = """Usage: %(progname)s edit-tag [options] name
|
||||
expected_stderr = """Usage: %(progname)s edit-tag [options] <name>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%(progname)s: error: Please specify a name for the tag
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class TestEditUser(unittest.TestCase):
|
|||
handle_edit_user(options, session, args)
|
||||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = """Usage: %s edit-user name [options]
|
||||
expected_stdout = """Usage: %s edit-user <username> [options]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
@ -106,7 +106,7 @@ Options:
|
|||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = ''
|
||||
expected_stderr = """Usage: %(progname)s edit-user name [options]
|
||||
expected_stderr = """Usage: %(progname)s edit-user <username> [options]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%(progname)s: error: You must specify the username of the user to edit
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class TestEnableHost(utils.CliTestCase):
|
|||
maxDiff = None
|
||||
|
||||
def setUp(self):
|
||||
self.error_format = """Usage: %s enable-host [options] hostname ...
|
||||
self.error_format = """Usage: %s enable-host [options] <hostname> [<hostname> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -122,7 +122,7 @@ class TestEnableHost(utils.CliTestCase):
|
|||
"""Test %s help message""" % handle_enable_host.__name__
|
||||
self.assert_help(
|
||||
handle_enable_host,
|
||||
"""Usage: %s enable-host [options] hostname ...
|
||||
"""Usage: %s enable-host [options] <hostname> [<hostname> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class TestEnableUser(utils.CliTestCase):
|
|||
maxDiff = None
|
||||
|
||||
def setUp(self):
|
||||
self.error_format = """Usage: %s enable-user username
|
||||
self.error_format = """Usage: %s enable-user <username>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -63,7 +63,7 @@ class TestEnableUser(utils.CliTestCase):
|
|||
def test_handle_enable_user_help(self):
|
||||
self.assert_help(
|
||||
handle_enable_user,
|
||||
"""Usage: %s enable-user username
|
||||
"""Usage: %s enable-user <username>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ class TestHello(utils.CliTestCase):
|
|||
print_unicode_mock.return_value = "Hello"
|
||||
|
||||
expect = """Usage: %s moshimoshi [options]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: This command takes no arguments
|
||||
""" % (self.progname, self.progname)
|
||||
|
|
@ -102,6 +103,7 @@ class TestHello(utils.CliTestCase):
|
|||
self.assert_help(
|
||||
handle_moshimoshi,
|
||||
"""Usage: %s moshimoshi [options]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
-h, --help show this help message and exit
|
||||
|
|
|
|||
|
|
@ -227,8 +227,8 @@ class TestImageBuild(utils.CliTestCase):
|
|||
self.session = mock.MagicMock()
|
||||
self.configparser = mock.patch('six.moves.configparser.ConfigParser').start()
|
||||
|
||||
self.error_format = """Usage: %s image-build [options] <name> <version> <target> <install-tree-url> <arch> [<arch>...]
|
||||
%s image-build --config FILE
|
||||
self.error_format = """Usage: %s image-build [options] <name> <version> <target> <install-tree-url> <arch> [<arch> ...]
|
||||
%s image-build --config <FILE>
|
||||
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
|
|
@ -328,8 +328,8 @@ class TestImageBuild(utils.CliTestCase):
|
|||
"""Test handle_image_build help message"""
|
||||
self.assert_help(
|
||||
handle_image_build,
|
||||
"""Usage: %s image-build [options] <name> <version> <target> <install-tree-url> <arch> [<arch>...]
|
||||
%s image-build --config FILE
|
||||
"""Usage: %s image-build [options] <name> <version> <target> <install-tree-url> <arch> [<arch> ...]
|
||||
%s image-build --config <FILE>
|
||||
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ class TestImageBuildIndirection(utils.CliTestCase):
|
|||
self.session = mock.MagicMock()
|
||||
|
||||
self.error_format = """Usage: %s image-build-indirection [base_image] [utility_image] [indirection_build_template]
|
||||
%s image-build --config FILE
|
||||
%s image-build --config <FILE>
|
||||
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
|
|
@ -220,7 +220,7 @@ class TestImageBuildIndirection(utils.CliTestCase):
|
|||
self.assert_help(
|
||||
handle_image_build_indirection,
|
||||
"""Usage: %s image-build-indirection [base_image] [utility_image] [indirection_build_template]
|
||||
%s image-build --config FILE
|
||||
%s image-build --config <FILE>
|
||||
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class TestImport(utils.CliTestCase):
|
|||
'CANCELED': 4,
|
||||
}
|
||||
|
||||
self.error_format = """Usage: %s import [options] package [package...]
|
||||
self.error_format = """Usage: %s import [options] <package> [<package> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -681,7 +681,7 @@ class TestImport(utils.CliTestCase):
|
|||
"""Test handle_import function help message"""
|
||||
self.assert_help(
|
||||
handle_import,
|
||||
"""Usage: %s import [options] package [package...]
|
||||
"""Usage: %s import [options] <package> [<package> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class TestImportCG(utils.CliTestCase):
|
|||
def setUp(self):
|
||||
self.custom_os_path_exists = {}
|
||||
self.os_path_exists = os.path.exists
|
||||
self.error_format = """Usage: %s import-cg [options] metadata_file files_dir
|
||||
self.error_format = """Usage: %s import-cg [options] <metadata_file> <files_dir>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -209,7 +209,7 @@ class TestImportCG(utils.CliTestCase):
|
|||
"""Test handle_import_cg help message"""
|
||||
self.assert_help(
|
||||
handle_import_cg,
|
||||
"""Usage: %s import-cg [options] metadata_file files_dir
|
||||
"""Usage: %s import-cg [options] <metadata_file> <files_dir>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
from __future__ import absolute_import
|
||||
import base64
|
||||
import copy
|
||||
import hashlib
|
||||
import mock
|
||||
|
|
@ -68,7 +67,7 @@ class TestImportSIG(utils.CliTestCase):
|
|||
}
|
||||
]
|
||||
|
||||
self.error_format = """Usage: %s import-sig [options] package [package...]
|
||||
self.error_format = """Usage: %s import-sig [options] <package> [<package> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -274,7 +273,7 @@ class TestImportSIG(utils.CliTestCase):
|
|||
"""Test handle_import_sig help message"""
|
||||
self.assert_help(
|
||||
handle_import_sig,
|
||||
"""Usage: %s import-sig [options] package [package...]
|
||||
"""Usage: %s import-sig [options] <package> [<package> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class TestListGroups(utils.CliTestCase):
|
|||
self.activate_session = mock.patch('koji_cli.commands.activate_session').start()
|
||||
self.event_from_opts = mock.patch('koji.util.eventFromOpts').start()
|
||||
|
||||
self.error_format = """Usage: %s list-groups [options] <tag> [group]
|
||||
self.error_format = """Usage: %s list-groups [options] <tag> [<group>]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -184,7 +184,7 @@ class TestListGroups(utils.CliTestCase):
|
|||
def test_anon_handle_list_groups_help(self):
|
||||
self.assert_help(
|
||||
anon_handle_list_groups,
|
||||
"""Usage: %s list-groups [options] <tag> [group]
|
||||
"""Usage: %s list-groups [options] <tag> [<group>]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class TestCliListTagged(utils.CliTestCase):
|
|||
self.original_timezone = os.environ.get('TZ')
|
||||
os.environ['TZ'] = 'US/Eastern'
|
||||
time.tzset()
|
||||
self.error_format = """Usage: %s list-tagged [options] tag [package]
|
||||
self.error_format = """Usage: %s list-tagged [options] <tag> [<package>]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -232,7 +232,7 @@ class TestCliListTagged(utils.CliTestCase):
|
|||
def test_handle_list_tagged_help(self):
|
||||
self.assert_help(
|
||||
anon_handle_list_tagged,
|
||||
"""Usage: %s list-tagged [options] tag [package]
|
||||
"""Usage: %s list-tagged [options] <tag> [<package>]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -108,8 +108,8 @@ Task info: weburl/taskinfo?taskID=1
|
|||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = ''
|
||||
expected_stderr = """Usage: %s maven-build [options] target URL
|
||||
%s maven-build --ini=CONFIG... [options] target
|
||||
expected_stderr = """Usage: %s maven-build [options] <target> <URL>
|
||||
%s maven-build --ini=CONFIG... [options] <target>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Exactly two arguments (a build target and a SCM URL) are required
|
||||
|
|
@ -151,8 +151,8 @@ Task info: weburl/taskinfo?taskID=1
|
|||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = ''
|
||||
expected_stderr = """Usage: %s maven-build [options] target URL
|
||||
%s maven-build --ini=CONFIG... [options] target
|
||||
expected_stderr = """Usage: %s maven-build [options] <target> <URL>
|
||||
%s maven-build --ini=CONFIG... [options] <target>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Exactly one argument (a build target) is required
|
||||
|
|
@ -193,8 +193,8 @@ Task info: weburl/taskinfo?taskID=1
|
|||
handle_maven_build(self.options, self.session, args)
|
||||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = """Usage: %s maven-build [options] target URL
|
||||
%s maven-build --ini=CONFIG... [options] target
|
||||
expected_stdout = """Usage: %s maven-build [options] <target> <URL>
|
||||
%s maven-build --ini=CONFIG... [options] <target>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
@ -268,8 +268,8 @@ Options:
|
|||
with self.assertRaises(SystemExit) as cm:
|
||||
handle_maven_build(self.options, self.session, args)
|
||||
actual = stderr.getvalue()
|
||||
expected = """Usage: %s maven-build [options] target URL
|
||||
%s maven-build --ini=CONFIG... [options] target
|
||||
expected = """Usage: %s maven-build [options] <target> <URL>
|
||||
%s maven-build --ini=CONFIG... [options] <target>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Unknown build target: target
|
||||
|
|
@ -316,8 +316,8 @@ Options:
|
|||
with self.assertRaises(SystemExit) as cm:
|
||||
handle_maven_build(self.options, self.session, args)
|
||||
actual = stderr.getvalue()
|
||||
expected = """Usage: %s maven-build [options] target URL
|
||||
%s maven-build --ini=CONFIG... [options] target
|
||||
expected = """Usage: %s maven-build [options] <target> <URL>
|
||||
%s maven-build --ini=CONFIG... [options] <target>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Unknown destination tag: dest_tag
|
||||
|
|
@ -364,8 +364,8 @@ Options:
|
|||
with self.assertRaises(SystemExit) as cm:
|
||||
handle_maven_build(self.options, self.session, args)
|
||||
actual = stderr.getvalue()
|
||||
expected = """Usage: %s maven-build [options] target URL
|
||||
%s maven-build --ini=CONFIG... [options] target
|
||||
expected = """Usage: %s maven-build [options] <target> <URL>
|
||||
%s maven-build --ini=CONFIG... [options] <target>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Destination tag dest_tag is locked
|
||||
|
|
@ -476,8 +476,8 @@ Task info: weburl/taskinfo?taskID=1
|
|||
with self.assertRaises(SystemExit) as cm:
|
||||
handle_maven_build(self.options, self.session, args)
|
||||
actual = stderr.getvalue()
|
||||
expected = """Usage: %s maven-build [options] target URL
|
||||
%s maven-build --ini=CONFIG... [options] target
|
||||
expected = """Usage: %s maven-build [options] <target> <URL>
|
||||
%s maven-build --ini=CONFIG... [options] <target>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Section section does not contain a maven-build config
|
||||
|
|
@ -507,8 +507,8 @@ Task info: weburl/taskinfo?taskID=1
|
|||
with self.assertRaises(SystemExit) as cm:
|
||||
handle_maven_build(self.options, self.session, args)
|
||||
actual = stderr.getvalue()
|
||||
expected = """Usage: %s maven-build [options] target URL
|
||||
%s maven-build --ini=CONFIG... [options] target
|
||||
expected = """Usage: %s maven-build [options] <target> <URL>
|
||||
%s maven-build --ini=CONFIG... [options] <target>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: errormsg
|
||||
|
|
@ -557,8 +557,8 @@ Task info: weburl/taskinfo?taskID=1
|
|||
with self.assertRaises(SystemExit) as cm:
|
||||
handle_maven_build(self.options, self.session, args)
|
||||
actual = stderr.getvalue()
|
||||
expected = """Usage: %s maven-build [options] target URL
|
||||
%s maven-build --ini=CONFIG... [options] target
|
||||
expected = """Usage: %s maven-build [options] <target> <URL>
|
||||
%s maven-build --ini=CONFIG... [options] <target>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Invalid SCM URL: badscm
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class TestMavenChain(utils.CliTestCase):
|
|||
self.config = 'config'
|
||||
self.task_id = 101
|
||||
|
||||
self.error_format = """Usage: %s maven-chain [options] target config...
|
||||
self.error_format = """Usage: %s maven-chain [options] <target> <config> [<config> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -175,7 +175,7 @@ class TestMavenChain(utils.CliTestCase):
|
|||
"""Test handle_maven_chain help message full output"""
|
||||
self.assert_help(
|
||||
handle_maven_chain,
|
||||
"""Usage: %s maven-chain [options] target config...
|
||||
"""Usage: %s maven-chain [options] <target> <config> [<config> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class TestMoveBuild(utils.CliTestCase):
|
|||
self.session = mock.MagicMock()
|
||||
self.options = mock.MagicMock()
|
||||
|
||||
self.error_format = """Usage: %s move-build [options] <tag1> <tag2> <pkg> [<pkg>...]
|
||||
self.error_format = """Usage: %s move-build [options] <tag1> <tag2> <pkg> [<pkg> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -147,7 +147,7 @@ class TestMoveBuild(utils.CliTestCase):
|
|||
"""Test handle_move_build help message"""
|
||||
self.assert_help(
|
||||
handle_move_build,
|
||||
"""Usage: %s move-build [options] <tag1> <tag2> <pkg> [<pkg>...]
|
||||
"""Usage: %s move-build [options] <tag1> <tag2> <pkg> [<pkg> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ class TestRemoveChannel(unittest.TestCase):
|
|||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = ''
|
||||
expected_stderr = """Usage: %s remove-channel [options] channel
|
||||
expected_stderr = """Usage: %s remove-channel [options] <channel>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Incorrect number of arguments
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class TestRemoveGroup(utils.CliTestCase):
|
|||
session.getTag.return_value = None
|
||||
|
||||
with self.assertRaises(SystemExit):
|
||||
rv = handle_remove_group(options, session, arguments)
|
||||
handle_remove_group(options, session, arguments)
|
||||
|
||||
# assert that things were called as we expected.
|
||||
activate_session_mock.assert_called_once_with(session, options)
|
||||
|
|
@ -58,7 +58,7 @@ class TestRemoveGroup(utils.CliTestCase):
|
|||
session.getTagGroups.return_value = []
|
||||
|
||||
with self.assertRaises(SystemExit):
|
||||
rv = handle_remove_group(options, session, arguments)
|
||||
handle_remove_group(options, session, arguments)
|
||||
|
||||
# assert that things were called as we expected.
|
||||
activate_session_mock.assert_called_once_with(session, options)
|
||||
|
|
@ -111,8 +111,8 @@ class TestRemoveGroup(utils.CliTestCase):
|
|||
stderr=expected,
|
||||
activate_session=None)
|
||||
|
||||
# if we don't have 'admin' permission
|
||||
# if we don't have 'tag' permission
|
||||
session.hasPerm.return_value = False
|
||||
with self.assertRaises(SystemExit):
|
||||
rv = handle_remove_group(options, session, ['tag', 'grp'])
|
||||
handle_remove_group(options, session, ['tag', 'grp'])
|
||||
activate_session_mock.assert_called_with(session, options)
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ class TestRemoveHostFromChannel(unittest.TestCase):
|
|||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = ''
|
||||
expected_stderr = """Usage: %s remove-host-from-channel [options] hostname channel
|
||||
expected_stderr = """Usage: %s remove-host-from-channel [options] <hostname> <channel>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Please specify a hostname and a channel
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ class TestRemovePkg(unittest.TestCase):
|
|||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = ''
|
||||
expected_stderr = """Usage: %s remove-pkg [options] tag package [package2 ...]
|
||||
expected_stderr = """Usage: %s remove-pkg [options] <tag> <package> [<package> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Please specify a tag and at least one package
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ class TestRenameChannel(unittest.TestCase):
|
|||
actual_stdout = stdout.getvalue()
|
||||
actual_stderr = stderr.getvalue()
|
||||
expected_stdout = ''
|
||||
expected_stderr = """Usage: %s rename-channel [options] old-name new-name
|
||||
expected_stderr = """Usage: %s rename-channel [options] <old-name> <new-name>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: Incorrect number of arguments
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ Log Files:
|
|||
/mnt/koji/work/tasks/2/2/mergerepos.log
|
||||
"""
|
||||
|
||||
self.error_format = """Usage: %s resubmit [options] taskID
|
||||
self.error_format = """Usage: %s resubmit [options] <task_id>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -123,7 +123,7 @@ Log Files:
|
|||
"""Test handle_resubmit help message output"""
|
||||
self.assert_help(
|
||||
handle_resubmit,
|
||||
"""Usage: %s resubmit [options] taskID
|
||||
"""Usage: %s resubmit [options] <task_id>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class TestSearch(utils.CliTestCase):
|
|||
maxDiff = None
|
||||
|
||||
def setUp(self):
|
||||
self.error_format = """Usage: %s search [options] search_type pattern
|
||||
self.error_format = """Usage: %s search [options] <search_type> <pattern>
|
||||
Available search types: package, build, tag, target, user, host, rpm, maven, win
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ Available search types: package, build, tag, target, user, host, rpm, maven, win
|
|||
def test_anon_handle_search_help(self):
|
||||
self.assert_help(
|
||||
anon_handle_search,
|
||||
"""Usage: %s search [options] search_type pattern
|
||||
"""Usage: %s search [options] <search_type> <pattern>
|
||||
Available search types: package, build, tag, target, user, host, rpm, maven, win
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class TestSetBuildVolume(utils.CliTestCase):
|
|||
maxDiff = None
|
||||
|
||||
def setUp(self):
|
||||
self.error_format = """Usage: %s set-build-volume volume n-v-r [n-v-r ...]
|
||||
self.error_format = """Usage: %s set-build-volume <volume> <n-v-r> [<n-v-r> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -104,7 +104,7 @@ class TestSetBuildVolume(utils.CliTestCase):
|
|||
def test_handle_set_build_volume_help(self):
|
||||
self.assert_help(
|
||||
handle_set_build_volume,
|
||||
"""Usage: %s set-build-volume volume n-v-r [n-v-r ...]
|
||||
"""Usage: %s set-build-volume <volume> <n-v-r> [<n-v-r> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class TestSetPkgArches(utils.CliTestCase):
|
|||
maxDiff = None
|
||||
|
||||
def setUp(self):
|
||||
self.error_format = """Usage: %s set-pkg-arches [options] arches tag package [package2 ...]
|
||||
self.error_format = """Usage: %s set-pkg-arches [options] <arches> <tag> <package> [<package> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -59,7 +59,7 @@ class TestSetPkgArches(utils.CliTestCase):
|
|||
def test_handle_set_pkg_arches_help(self):
|
||||
self.assert_help(
|
||||
handle_set_pkg_arches,
|
||||
"""Usage: %s set-pkg-arches [options] arches tag package [package2 ...]
|
||||
"""Usage: %s set-pkg-arches [options] <arches> <tag> <package> [<package> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class TestSetPkgOwner(utils.CliTestCase):
|
|||
maxDiff = None
|
||||
|
||||
def setUp(self):
|
||||
self.error_format = """Usage: %s set-pkg-owner [options] owner tag package [package2 ...]
|
||||
self.error_format = """Usage: %s set-pkg-owner [options] <owner> <tag> <package> [<package> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -59,7 +59,7 @@ class TestSetPkgOwner(utils.CliTestCase):
|
|||
def test_handle_set_pkg_owner_help(self):
|
||||
self.assert_help(
|
||||
handle_set_pkg_owner,
|
||||
"""Usage: %s set-pkg-owner [options] owner tag package [package2 ...]
|
||||
"""Usage: %s set-pkg-owner [options] <owner> <tag> <package> [<package> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class TestSetTaskPriority(utils.CliTestCase):
|
|||
maxDiff = None
|
||||
|
||||
def setUp(self):
|
||||
self.error_format = """Usage: %s set-task-priority [options] --priority=<priority> <task-id> [task-id]...
|
||||
self.error_format = """Usage: %s set-task-priority [options] --priority=<priority> <task_id> [<task_id> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -82,7 +82,7 @@ class TestSetTaskPriority(utils.CliTestCase):
|
|||
def test_handle_set_task_priority_help(self):
|
||||
self.assert_help(
|
||||
handle_set_task_priority,
|
||||
"""Usage: %s set-task-priority [options] --priority=<priority> <task-id> [task-id]...
|
||||
"""Usage: %s set-task-priority [options] --priority=<priority> <task_id> [<task_id> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class TestTagBuild(utils.CliTestCase):
|
|||
self.session = mock.MagicMock()
|
||||
self.options = mock.MagicMock()
|
||||
|
||||
self.error_format = """Usage: %s tag-build [options] <tag> <pkg> [<pkg>...]
|
||||
self.error_format = """Usage: %s tag-build [options] <tag> <pkg> [<pkg> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -89,7 +89,7 @@ class TestTagBuild(utils.CliTestCase):
|
|||
def test_handle_tag_build_help(self):
|
||||
self.assert_help(
|
||||
handle_tag_build,
|
||||
"""Usage: %s tag-build [options] <tag> <pkg> [<pkg>...]
|
||||
"""Usage: %s tag-build [options] <tag> <pkg> [<pkg> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -588,7 +588,7 @@ class TestTaskInfo(utils.CliTestCase):
|
|||
maxDiff = None
|
||||
|
||||
def setUp(self):
|
||||
self.error_format = """Usage: %s taskinfo [options] taskID [taskID...]
|
||||
self.error_format = """Usage: %s taskinfo [options] <task_id> [<task_id> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -638,7 +638,7 @@ Host: kojibuilder
|
|||
def test_anon_handle_taskinfo_help(self):
|
||||
self.assert_help(
|
||||
anon_handle_taskinfo,
|
||||
"""Usage: %s taskinfo [options] taskID [taskID...]
|
||||
"""Usage: %s taskinfo [options] <task_id> [<task_id> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class TestBlockGroupPkg(utils.CliTestCase):
|
|||
self.options = mock.MagicMock()
|
||||
self.activate_session = mock.patch('koji_cli.commands.activate_session').start()
|
||||
|
||||
self.error_format = """Usage: %s unblock-group-pkg [options] <tag> <group> <pkg> [<pkg>...]
|
||||
self.error_format = """Usage: %s unblock-group-pkg [options] <tag> <group> <pkg> [<pkg> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -54,7 +54,7 @@ class TestBlockGroupPkg(utils.CliTestCase):
|
|||
def test_handle_unblock_group_pkg_help(self):
|
||||
self.assert_help(
|
||||
handle_unblock_group_pkg,
|
||||
"""Usage: %s unblock-group-pkg [options] <tag> <group> <pkg> [<pkg>...]
|
||||
"""Usage: %s unblock-group-pkg [options] <tag> <group> <pkg> [<pkg> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class TestUnblockPkg(utils.CliTestCase):
|
|||
maxDiff = None
|
||||
|
||||
def setUp(self):
|
||||
self.error_format = """Usage: %s unblock-pkg [options] tag package [package2 ...]
|
||||
self.error_format = """Usage: %s unblock-pkg [options] <tag> <package> [<package> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -60,7 +60,7 @@ class TestUnblockPkg(utils.CliTestCase):
|
|||
def test_handle_unblock_pkg_help(self):
|
||||
self.assert_help(
|
||||
handle_unblock_pkg,
|
||||
"""Usage: %s unblock-pkg [options] tag package [package2 ...]
|
||||
"""Usage: %s unblock-pkg [options] <tag> <package> [<package> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class TestWrapperRpm(utils.CliTestCase):
|
|||
self.scm_url = 'git+https://github.com/project/test#12345'
|
||||
self.task_id = 1
|
||||
|
||||
self.error_format = """Usage: %s wrapper-rpm [options] target build-id|n-v-r URL
|
||||
self.error_format = """Usage: %s wrapper-rpm [options] <target> <build-id|n-v-r> <URL>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -223,7 +223,7 @@ class TestWrapperRpm(utils.CliTestCase):
|
|||
"""Test handle_wrapper_rpm help message output"""
|
||||
self.assert_help(
|
||||
handle_wrapper_rpm,
|
||||
"""Usage: %s wrapper-rpm [options] target build-id|n-v-r URL
|
||||
"""Usage: %s wrapper-rpm [options] <target> <build-id|n-v-r> <URL>
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ class TestWriteSignedRPM(utils.CliTestCase):
|
|||
def setUp(self):
|
||||
self.custom_os_path_exists = {}
|
||||
self.os_path_exists = os.path.exists
|
||||
self.error_format = """Usage: %s write-signed-rpm [options] <signature-key> n-v-r [n-v-r...]
|
||||
self.error_format = """Usage: %s write-signed-rpm [options] <signature-key> <n-v-r> [<n-v-r> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -238,7 +238,7 @@ class TestWriteSignedRPM(utils.CliTestCase):
|
|||
"""Test handle_write_signed_rpm help message"""
|
||||
self.assert_help(
|
||||
handle_write_signed_rpm,
|
||||
"""Usage: %s write-signed-rpm [options] <signature-key> n-v-r [n-v-r...]
|
||||
"""Usage: %s write-signed-rpm [options] <signature-key> <n-v-r> [<n-v-r> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue