Unify error messages related to hosts and users

Fixes: https://pagure.io/koji/issue/2858
This commit is contained in:
Jana Cupova 2021-05-12 16:51:19 +02:00 committed by Tomas Kopecek
parent f2c314d07b
commit 8ecfc53119
5 changed files with 10 additions and 10 deletions

View file

@ -68,7 +68,7 @@ class TestDisableHost(utils.CliTestCase):
session.editHost.assert_not_called()
expect = ''
for host in arguments:
expect += "Host %s does not exist\n" % host
expect += "No such host: %s\n" % host
self.assert_console_message(stdout, expect)
self.assert_console_message(stderr, "No changes made. Please correct the command line.\n")

View file

@ -203,9 +203,9 @@ class TestEditHost(utils.CliTestCase):
handle_edit_host(options, session, args)
self.assertExitCode(ex, 1)
actual = stderr.getvalue()
expected = """Host host does not exist
expected = """No such host: %s
No changes made, please correct the command line
"""
""" % host
self.assertMultiLineEqual(actual, expected)
# Finally, assert that things were called as we expected.
activate_session_mock.assert_called_once_with(session, options)

View file

@ -67,7 +67,7 @@ class TestEnableHost(utils.CliTestCase):
session.editHost.assert_not_called()
expect = ''
for host in arguments:
expect += "Host %s does not exist\n" % host
expect += "No such host: %s\n" % host
stderr_exp = "No changes made. Please correct the command line.\n"
self.assert_console_message(stdout, expect)
self.assert_console_message(stderr, stderr_exp)

View file

@ -51,7 +51,7 @@ class TestListPermissions(utils.CliTestCase):
activate_session=None)
# case 2. user does not exists
expected = "User %s does not exist" % user + "\n"
expected = "No such user: %s" % user + "\n"
session.getUser.return_value = None
with self.assertRaises(SystemExit) as ex:
handle_list_permissions(options, session, ['--user', user])