more missing tearDowns
This commit is contained in:
parent
f49ee80a7b
commit
2485b87294
65 changed files with 189 additions and 6 deletions
|
|
@ -26,6 +26,9 @@ class TestAddChannel(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
def test_handle_add_channel(self, stdout):
|
||||
self.session.addChannel.return_value = self.channel_id
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@ class TestAddExternalRepo(utils.CliTestCase):
|
|||
self.tag = 'test-tag'
|
||||
self.priority = 10
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_add_external_repo_invalid_mode(self):
|
||||
mode = 'test-mode'
|
||||
arguments = ['--mode', mode]
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ class TestAddGroup(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
def test_handle_add_group(self, stdout):
|
||||
tag = 'tag'
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ class TestAddHost(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
def test_handle_add_host(self, stdout):
|
||||
host = 'host'
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ class TestAddHostToChannel(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
def test_handle_add_host_to_channel(self, stdout):
|
||||
host = 'host'
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ class TestAddNotification(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_handle_add_notification(self):
|
||||
self.session.getPackageID.return_value = 1234
|
||||
self.session.getTagID.return_value = 4321
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@ class TestAddPkg(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
def test_handle_add_pkg(self, stdout):
|
||||
tag = 'tag'
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ class TestAddTag(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_handle_add_tag(self):
|
||||
"""Test handle_add_tag function"""
|
||||
# Case 1. no argument error
|
||||
|
|
|
|||
|
|
@ -56,6 +56,9 @@ class TestAddTagInheritance(utils.CliTestCase):
|
|||
'perm': None,
|
||||
'perm_id': None}
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_add_tag_inheritance_without_option(self):
|
||||
arguments = []
|
||||
expected = self.format_error_message(
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@ class TestAddTarget(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_add_target_without_option(self,):
|
||||
expected = self.format_error_message(
|
||||
"Please specify a target name, a build tag, and destination tag")
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@ class TestAddUser(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
def test_handle_add_user(self, stdout):
|
||||
"""Test handle_add_user function"""
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ class TestAddVolume(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
def test_handle_add_volume(self, stdout):
|
||||
"""Test handle_add_volume function"""
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ class TestAssignTask(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
def test_handle_assign_task(self, stdout):
|
||||
hostname = "host"
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@ class TestBlockGroup(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_handle_block_group_nonexistent_tag(self):
|
||||
tag = 'nonexistent-tag'
|
||||
group = 'group'
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ class TestBlockNotification(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_handle_block_notification_non_exist_tag(self):
|
||||
tag = 'test-tag'
|
||||
arguments = ['--tag', tag]
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ class TestBlockPkg(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
def test_handle_block_pkg(self, stdout):
|
||||
tag = 'tag'
|
||||
|
|
|
|||
|
|
@ -48,6 +48,9 @@ https://docs.pagure.org/koji/HOWTO/#package-organization
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
def test_handle_build_from_srpm(self, stdout):
|
||||
args = [self.target, self.source_srpm]
|
||||
|
|
|
|||
|
|
@ -29,6 +29,9 @@ Note, that you can use global option --noauth for anonymous calls here
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
def test_handle_call(self, stdout):
|
||||
"""Test handle_call function"""
|
||||
|
|
|
|||
|
|
@ -35,6 +35,9 @@ class TestCancel(utils.CliTestCase):
|
|||
self.session.hub_version = (1, 33, 0)
|
||||
self.session.hub_version_str = '1.33.0'
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_anon_cancel(self):
|
||||
args = ['123']
|
||||
self.activate_session_mock.side_effect = koji.GenericError
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ class TestChainBuild(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
def test_handle_chain_build(self, stdout):
|
||||
target = 'target'
|
||||
|
|
|
|||
|
|
@ -29,6 +29,9 @@ class TestDisableChannel(utils.CliTestCase):
|
|||
'name': 'test-channel'}
|
||||
]
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def __vm(self, result):
|
||||
m = koji.VirtualCall('mcall_method', [], {})
|
||||
if isinstance(result, dict) and result.get('faultCode'):
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ class TestDisableHost(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_handle_disable_host_no_such_host(self):
|
||||
"""Test %s function""" % handle_disable_host.__name__
|
||||
self.session.getHost.return_value = None
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ class TestDisableUser(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_handle_disable_user_no_argument(self):
|
||||
"""Test handle_disable_user function"""
|
||||
expected = self.format_error_message(
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ class TestEditExternalRepo(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_handle_edit_external_repo_error(self):
|
||||
"""Test handle_edit_external_repo function"""
|
||||
# [(expected, args),...]
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@ class TestEditHost(utils.CliTestCase):
|
|||
self.description = 'description'
|
||||
self.comment = 'comment'
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
def test_handle_edit_host(self, stdout):
|
||||
host_info = mock.ANY
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ class TestEditNotification(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_handle_edit_notification(self):
|
||||
self.session.getPackageID.return_value = 1234
|
||||
self.session.getTagID.return_value = 4321
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ class TestEditPermission(utils.CliTestCase):
|
|||
self.perm = 'test-perm'
|
||||
self.description = 'test-description'
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_handle_edit_permission_argument_error(self):
|
||||
expected = self.format_error_message("Please specify a permission and a description")
|
||||
for args in [[], [self.perm]]:
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ class TestEditTag(utils.CliTestCase):
|
|||
self.extra = {'extraA': 'A', 'extraB': True}
|
||||
self.remove_extra = ['extraC', 'extraD']
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
def test_handle_edit_tag_1(self, stdout):
|
||||
args = [self.tag]
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ class TestEditTarget(utils.CliTestCase):
|
|||
self.new_dest_tag = 'new-dest-tag'
|
||||
self.new_build_tag = 'new-build-tag'
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_edit_target_without_option(self):
|
||||
expected = self.format_error_message("Please specify a build target")
|
||||
self.assert_system_exit(
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ class TestEditUser(utils.CliTestCase):
|
|||
self.user = 'user'
|
||||
self.rename = 'user2'
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
def test_handle_edit_user(self, stdout):
|
||||
args = [self.user]
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ class TestEnableChannel(utils.CliTestCase):
|
|||
'name': 'test-channel'}
|
||||
]
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def __vm(self, result):
|
||||
m = koji.VirtualCall('mcall_method', [], {})
|
||||
if isinstance(result, dict) and result.get('faultCode'):
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@ class TestEnableHost(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_handle_enable_host_no_such_host(self):
|
||||
"""Test %s function""" % handle_enable_host.__name__
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ class TestEnableUser(utils.CliTestCase):
|
|||
""" % (self.progname, self.progname)
|
||||
self.username = 'user'
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_handle_enable_user_no_argument(self):
|
||||
"""Test handle_enable_user function"""
|
||||
expected = self.format_error_message("You must specify the username of the user to enable")
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ class TestFreeTask(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_free_task_without_arg(self):
|
||||
expected = self.format_error_message('please specify at least one task_id')
|
||||
self.assert_system_exit(
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@ class TestGrantCGAccess(utils.CliTestCase):
|
|||
self.cg = 'cg'
|
||||
self.user = 'user'
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_handle_grant_cg_access_arg_error(self):
|
||||
"""Test handle_grant_cg_access function"""
|
||||
expected = self.format_error_message("Please specify a user and content generator")
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ class TestGrantPermission(utils.CliTestCase):
|
|||
self.perm = 'createuser'
|
||||
self.user = 'user'
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_handle_grant_permission_argument_error(self):
|
||||
expected = self.format_error_message(
|
||||
"Please specify a permission and at least one user")
|
||||
|
|
|
|||
|
|
@ -39,6 +39,9 @@ class TestHello(utils.CliTestCase):
|
|||
""" % (self.progname, self.progname)
|
||||
self.huburl = "https://%s.local/%shub" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
@mock.patch('koji_cli.commands._printable_unicode')
|
||||
def test_handle_moshimoshi(self, print_unicode_mock, stdout):
|
||||
|
|
|
|||
|
|
@ -84,6 +84,9 @@ class TestImport(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def __do_import_test(self, options, session, arguments, **kwargs):
|
||||
expected = kwargs.get('expected', None)
|
||||
rpm_header = kwargs.get('rpm_header', {})
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ class TestImportArchive(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_import_archive_without_option(self):
|
||||
expected = self.format_error_message(
|
||||
"You must specify a build ID or N-V-R and an archive to import")
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@ class TestImportCG(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
@mock.patch('koji_cli.commands._progress_callback')
|
||||
@mock.patch('koji.json')
|
||||
|
|
|
|||
|
|
@ -38,6 +38,9 @@ class TestImportComps(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
@mock.patch('koji_cli.commands.libcomps')
|
||||
@mock.patch('koji_cli.commands._import_comps')
|
||||
|
|
|
|||
|
|
@ -76,6 +76,9 @@ class TestImportSIG(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stderr', new_callable=six.StringIO)
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
@mock.patch('koji.rip_rpm_sighdr')
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ class TestListApi(utils.CliTestCase):
|
|||
self.options = mock.MagicMock()
|
||||
self.ensure_connection = mock.patch('koji_cli.commands.ensure_connection').start()
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
def test_anon_handle_list_api_all_method(self, stdout):
|
||||
"""Test anon_handle_list_api function"""
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@ class TestListBuilds(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_list_buildroot_without_args(self):
|
||||
self.assert_system_exit(
|
||||
anon_handle_list_buildroot,
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@ class TestListChannels(utils.CliTestCase):
|
|||
]]
|
||||
]
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=StringIO)
|
||||
def test_list_channels_not_quiet(self, stdout):
|
||||
self.session.listChannels.return_value = self.list_channels
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ class TestListNotifications(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=StringIO)
|
||||
def test_list_notifications(self, stdout):
|
||||
self.session.getBuildNotifications.return_value = [
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@ class TestListPermissions(utils.CliTestCase):
|
|||
self.user = 'tester'
|
||||
self.userinfo = {'id': 101, 'name': self.user}
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_handle_list_permissions_arg_error(self):
|
||||
"""Test handle_list_permissions argument error (no argument is required)"""
|
||||
expected = self.format_error_message("This command takes no arguments")
|
||||
|
|
|
|||
|
|
@ -52,6 +52,9 @@ class TestListPkgs(utils.CliTestCase):
|
|||
'perm': None,
|
||||
'perm_id': None}
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_list_pkgs_non_exist_tag(self):
|
||||
self.session.getTag.return_value = None
|
||||
self.assert_system_exit(
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@ class TestListSigned(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def __vm(self, result):
|
||||
m = koji.VirtualCall('mcall_method', [], {})
|
||||
if isinstance(result, dict) and result.get('faultCode'):
|
||||
|
|
|
|||
|
|
@ -38,6 +38,9 @@ class TestListTags(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_list_tags_non_exist_package(self):
|
||||
pkg = 'test-pkg'
|
||||
self.session.getPackage.return_value = None
|
||||
|
|
|
|||
|
|
@ -65,6 +65,9 @@ config_opts['macros']['%distribution'] = 'Koji Testing'
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
def test_handle_mock_config_buildroot_option(self, stdout):
|
||||
"""Test anon_handle_mock_config buildroot options"""
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ class TestRemoveExternalRepo(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_remove_external_repo_help(self):
|
||||
self.assert_help(
|
||||
handle_remove_external_repo,
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@ class TestRemovePkg(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stderr', new_callable=six.StringIO)
|
||||
def test_handle_remove_pkg(self, stderr):
|
||||
tag = 'tag'
|
||||
|
|
|
|||
|
|
@ -50,6 +50,9 @@ class TestRemoveTagInheritance(utils.CliTestCase):
|
|||
'perm': None,
|
||||
'perm_id': None}
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_remove_tag_inheritance_without_option(self):
|
||||
expected = self.format_error_message(
|
||||
"This command takes at least one argument: a tag name or ID")
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ class TestRestartHosts(utils.CliTestCase):
|
|||
self.watch_tasks_mock = mock.patch('koji_cli.commands.watch_tasks').start()
|
||||
self.task_id = 101
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_handle_restart_hosts_force_options(self):
|
||||
"""Test %s function with --force option""" % handle_restart_hosts.__name__
|
||||
arguments = ['--force']
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@ class TestSetTaskPriority(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('sys.stderr', new_callable=six.StringIO)
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
def test_handle_set_task_priority(self, stdout, stderr):
|
||||
|
|
|
|||
|
|
@ -52,6 +52,9 @@ class TestShowGroups(utils.CliTestCase):
|
|||
'group_id': 3}
|
||||
]
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_show_groups_incorrect_num_of_args(self):
|
||||
arguments = []
|
||||
self.assert_system_exit(
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@ class TestUntagBuild(utils.CliTestCase):
|
|||
'name': 'test-package', 'release': '1.f35', 'tag.name': 'test-tag',
|
||||
'tag_id': 460, 'version': '1.1'}]}
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def __vm(self, result):
|
||||
m = koji.VirtualCall('mcall_method', [], {})
|
||||
if isinstance(result, dict) and result.get('faultCode'):
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ class TestWatchLogs(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_handle_watch_logs_help(self):
|
||||
self.assert_help(
|
||||
anon_handle_watch_logs,
|
||||
|
|
|
|||
|
|
@ -39,6 +39,9 @@ class TestWinBuild(utils.CliTestCase):
|
|||
%s: error: {message}
|
||||
""" % (self.progname, self.progname)
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_win_build_without_option(self):
|
||||
self.assert_system_exit(
|
||||
handle_win_build,
|
||||
|
|
|
|||
|
|
@ -12,9 +12,6 @@ class TestGetNextRelease(DBQueryTestCase):
|
|||
self.get_build = mock.patch('kojihub.kojihub.get_build').start()
|
||||
self.binfo = {'name': 'name', 'version': 'version'}
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_get_next_release_new(self):
|
||||
# no previous build
|
||||
self.qp_execute_one_return_value = None
|
||||
|
|
|
|||
|
|
@ -15,9 +15,6 @@ class TestGetUser(DBQueryTestCase):
|
|||
self.list_user_krb_principals = mock.patch(
|
||||
'kojihub.kojihub.list_user_krb_principals').start()
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_wrong_format_user_info(self):
|
||||
userinfo = ['test-user']
|
||||
with self.assertRaises(koji.GenericError) as cm:
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ class TestHost(unittest.TestCase):
|
|||
self.queries = []
|
||||
self.query_execute = mock.MagicMock()
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('kojihub.kojihub.context')
|
||||
def test_instantiation_not_a_host(self, context):
|
||||
context.session.getHostId.return_value = None
|
||||
|
|
|
|||
|
|
@ -46,6 +46,9 @@ class TestVerifyUser(unittest.TestCase):
|
|||
self.context.opts = {'MaxNameLengthInternal': 15,
|
||||
'RegexUserName.compiled': re.compile('^[A-Za-z0-9/_.@-]+$')}
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_verify_user_type_name(self):
|
||||
expected_error = "Name should be string"
|
||||
with self.assertRaises(koji.GenericError) as cm:
|
||||
|
|
|
|||
|
|
@ -44,6 +44,9 @@ class TestAuthSession(unittest.TestCase):
|
|||
# start with "assert"
|
||||
self.context.session.assertLogin = mock.MagicMock()
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
def test_instance(self):
|
||||
"""Simple kojihub.auth.Session instance"""
|
||||
self.context.opts = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue