fix tests
This commit is contained in:
parent
556dddc9d0
commit
e6e618d0bb
136 changed files with 698 additions and 699 deletions
|
|
@ -15,11 +15,11 @@ class FakeException(Exception):
|
|||
class TestAddExternalRPM(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.get_rpm = mock.patch('kojihub.get_rpm').start()
|
||||
self.get_external_repo_id = mock.patch('kojihub.get_external_repo_id').start()
|
||||
self.nextval = mock.patch('kojihub.nextval').start()
|
||||
self.Savepoint = mock.patch('kojihub.Savepoint').start()
|
||||
self.InsertProcessor = mock.patch('kojihub.InsertProcessor',
|
||||
self.get_rpm = mock.patch('kojihub.kojihub.get_rpm').start()
|
||||
self.get_external_repo_id = mock.patch('kojihub.kojihub.get_external_repo_id').start()
|
||||
self.nextval = mock.patch('kojihub.kojihub.nextval').start()
|
||||
self.Savepoint = mock.patch('kojihub.kojihub.Savepoint').start()
|
||||
self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',
|
||||
side_effect=self.getInsert).start()
|
||||
self.inserts = []
|
||||
self.insert_execute = mock.MagicMock()
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class TestAddGroupMember(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
self.exports = kojihub.RootExports()
|
||||
self.get_user = mock.patch('kojihub.get_user').start()
|
||||
self.get_user = mock.patch('kojihub.kojihub.get_user').start()
|
||||
|
||||
def test_non_exist_user(self):
|
||||
data = [{'id': 3,
|
||||
|
|
|
|||
|
|
@ -32,16 +32,16 @@ class TestAddHost(unittest.TestCase):
|
|||
return query
|
||||
|
||||
def setUp(self):
|
||||
self.InsertProcessor = mock.patch('kojihub.InsertProcessor',
|
||||
self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',
|
||||
side_effect=self.getInsert).start()
|
||||
self.inserts = []
|
||||
self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',
|
||||
self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',
|
||||
side_effect=self.getUpdate).start()
|
||||
self.updates = []
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.context_db = mock.patch('koji.db.context').start()
|
||||
# It seems MagicMock will not automatically handle attributes that
|
||||
# start with "assert"
|
||||
|
|
@ -49,11 +49,11 @@ class TestAddHost(unittest.TestCase):
|
|||
self.context.session.assertPerm = mock.MagicMock()
|
||||
self.context.opts = {'HostPrincipalFormat': '-%s-'}
|
||||
self.exports = kojihub.RootExports()
|
||||
self.verify_host_name = mock.patch('kojihub.verify_host_name').start()
|
||||
self.verify_name_user = mock.patch('kojihub.verify_name_user').start()
|
||||
self.get_host = mock.patch('kojihub.get_host').start()
|
||||
self.nextval = mock.patch('kojihub.nextval').start()
|
||||
self.get_user = mock.patch('kojihub.get_user').start()
|
||||
self.verify_host_name = mock.patch('kojihub.kojihub.verify_host_name').start()
|
||||
self.verify_name_user = mock.patch('kojihub.kojihub.verify_name_user').start()
|
||||
self.get_host = mock.patch('kojihub.kojihub.get_host').start()
|
||||
self.nextval = mock.patch('kojihub.kojihub.nextval').start()
|
||||
self.get_user = mock.patch('kojihub.kojihub.get_user').start()
|
||||
self.query_singleValue = mock.MagicMock()
|
||||
|
||||
def tearDown(self):
|
||||
|
|
@ -80,7 +80,7 @@ class TestAddHost(unittest.TestCase):
|
|||
self.assertEqual(r, 12)
|
||||
|
||||
self.context.session.assertPerm.assert_called_once_with('host')
|
||||
kojihub.get_host.assert_called_once_with('hostname')
|
||||
self.get_host.assert_called_once_with('hostname')
|
||||
self.context.session.createUser.assert_called_once_with(
|
||||
'hostname', usertype=koji.USERTYPES['HOST'], krb_principal='-hostname-')
|
||||
self.nextval.assert_called_once_with('host_id_seq')
|
||||
|
|
@ -191,7 +191,7 @@ class TestAddHost(unittest.TestCase):
|
|||
self.exports.addHost('hostname', ['i386', 'x86_64'], krb_principal=krb_principal)
|
||||
|
||||
self.context.session.assertPerm.assert_called_once_with('host')
|
||||
kojihub.get_host.assert_called_once_with('hostname')
|
||||
self.get_host.assert_called_once_with('hostname')
|
||||
self.context.session.createUser.assert_not_called()
|
||||
self.verify_host_name.assert_called_once_with('hostname')
|
||||
self.nextval.assert_not_called()
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ class TestAddHostToChannel(unittest.TestCase):
|
|||
return insert
|
||||
|
||||
def setUp(self):
|
||||
self.InsertProcessor = mock.patch('kojihub.InsertProcessor',
|
||||
self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',
|
||||
side_effect=self.getInsert).start()
|
||||
self.inserts = []
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.context_db = mock.patch('koji.db.context').start()
|
||||
# It seems MagicMock will not automatically handle attributes that
|
||||
# start with "assert"
|
||||
|
|
@ -29,11 +29,11 @@ class TestAddHostToChannel(unittest.TestCase):
|
|||
self.context_db.session.user_id = 23
|
||||
self.context.opts = {'HostPrincipalFormat': '-%s-'}
|
||||
self.exports = kojihub.RootExports()
|
||||
self.get_channel = mock.patch('kojihub.get_channel').start()
|
||||
self.list_channels = mock.patch('kojihub.list_channels').start()
|
||||
self.get_channel_id = mock.patch('kojihub.get_channel_id').start()
|
||||
self.get_host = mock.patch('kojihub.get_host').start()
|
||||
self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()
|
||||
self.get_channel = mock.patch('kojihub.kojihub.get_channel').start()
|
||||
self.list_channels = mock.patch('kojihub.kojihub.list_channels').start()
|
||||
self.get_channel_id = mock.patch('kojihub.kojihub.get_channel_id').start()
|
||||
self.get_host = mock.patch('kojihub.kojihub.get_host').start()
|
||||
self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()
|
||||
self.cname = 'channel_name'
|
||||
self.name = 'hostname'
|
||||
self.host_info = {'id': 123, 'name': self.name}
|
||||
|
|
|
|||
|
|
@ -24,14 +24,14 @@ class TestAddRPMSig(unittest.TestCase):
|
|||
return query
|
||||
|
||||
def setUp(self):
|
||||
self.InsertProcessor = mock.patch('kojihub.InsertProcessor',
|
||||
self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',
|
||||
side_effect=self.getInsert).start()
|
||||
self.inserts = []
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.query_execute = mock.MagicMock()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
# It seems MagicMock will not automatically handle attributes that
|
||||
# start with "assert"
|
||||
self.context.session.assertLogin = mock.MagicMock()
|
||||
|
|
@ -44,11 +44,11 @@ class TestAddRPMSig(unittest.TestCase):
|
|||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('koji.plugin.run_callbacks')
|
||||
@mock.patch('kojihub.get_rpm')
|
||||
@mock.patch('kojihub.get_build')
|
||||
@mock.patch('kojihub.kojihub.get_rpm')
|
||||
@mock.patch('kojihub.kojihub.get_build')
|
||||
@mock.patch('os.path.isdir')
|
||||
@mock.patch('koji.ensuredir')
|
||||
@mock.patch('kojihub.open')
|
||||
@mock.patch('kojihub.kojihub.open')
|
||||
def test_add_rpm_sig_header_signed(
|
||||
self,
|
||||
open,
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ import copy
|
|||
class TestAddUserKrbPrincipal(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.get_user = mock.patch('kojihub.get_user').start()
|
||||
self.verify_name_user = mock.patch('kojihub.verify_name_user').start()
|
||||
self.get_user_by_krb_principal = mock.patch('kojihub.get_user_by_krb_principal').start()
|
||||
self.get_user = mock.patch('kojihub.kojihub.get_user').start()
|
||||
self.verify_name_user = mock.patch('kojihub.kojihub.verify_name_user').start()
|
||||
self.get_user_by_krb_principal = mock.patch('kojihub.kojihub.get_user_by_krb_principal').start()
|
||||
self.username = 'testuser'
|
||||
self.krbprincipal = '%s@TEST.COM' % self.username
|
||||
self.userinfo = {'id': 1, 'name': self.username}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ import kojihub
|
|||
class TestAddVolume(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
# It seems MagicMock will not automatically handle attributes that
|
||||
# start with "assert"
|
||||
self.context.session.assertPerm = mock.MagicMock()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import copy
|
||||
import unittest
|
||||
|
||||
import kojihub
|
||||
from kojihub.kojihub import _applyQueryOpts
|
||||
|
||||
|
||||
class TestApplyQueryOpts(unittest.TestCase):
|
||||
|
|
@ -15,7 +15,7 @@ class TestApplyQueryOpts(unittest.TestCase):
|
|||
def test_basic(self):
|
||||
opts = None
|
||||
expected = copy.copy(self.original)
|
||||
actual = kojihub._applyQueryOpts(self.original, opts)
|
||||
actual = _applyQueryOpts(self.original, opts)
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
def test_order_by_foo(self):
|
||||
|
|
@ -25,7 +25,7 @@ class TestApplyQueryOpts(unittest.TestCase):
|
|||
{'foo': 1, 'bar': 1},
|
||||
{'foo': 2, 'bar': -1},
|
||||
]
|
||||
actual = kojihub._applyQueryOpts(self.original, opts)
|
||||
actual = _applyQueryOpts(self.original, opts)
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
def test_order_by_bar(self):
|
||||
|
|
@ -35,7 +35,7 @@ class TestApplyQueryOpts(unittest.TestCase):
|
|||
{'foo': 0, 'bar': 0},
|
||||
{'foo': 1, 'bar': 1},
|
||||
]
|
||||
actual = kojihub._applyQueryOpts(self.original, opts)
|
||||
actual = _applyQueryOpts(self.original, opts)
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
def test_order_in_reverse(self):
|
||||
|
|
@ -45,7 +45,7 @@ class TestApplyQueryOpts(unittest.TestCase):
|
|||
{'foo': 1, 'bar': 1},
|
||||
{'foo': 0, 'bar': 0},
|
||||
]
|
||||
actual = kojihub._applyQueryOpts(self.original, opts)
|
||||
actual = _applyQueryOpts(self.original, opts)
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
def test_offset(self):
|
||||
|
|
@ -54,7 +54,7 @@ class TestApplyQueryOpts(unittest.TestCase):
|
|||
{'foo': 2, 'bar': -1},
|
||||
{'foo': 0, 'bar': 0},
|
||||
]
|
||||
actual = kojihub._applyQueryOpts(self.original, opts)
|
||||
actual = _applyQueryOpts(self.original, opts)
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
def test_limit(self):
|
||||
|
|
@ -63,7 +63,7 @@ class TestApplyQueryOpts(unittest.TestCase):
|
|||
{'foo': 1, 'bar': 1},
|
||||
{'foo': 2, 'bar': -1},
|
||||
]
|
||||
actual = kojihub._applyQueryOpts(self.original, opts)
|
||||
actual = _applyQueryOpts(self.original, opts)
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
def test_limit_and_offset(self):
|
||||
|
|
@ -71,16 +71,16 @@ class TestApplyQueryOpts(unittest.TestCase):
|
|||
expected = [
|
||||
{'foo': 2, 'bar': -1},
|
||||
]
|
||||
actual = kojihub._applyQueryOpts(self.original, opts)
|
||||
actual = _applyQueryOpts(self.original, opts)
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
def test_count_only(self):
|
||||
opts = {'countOnly': True}
|
||||
expected = 3
|
||||
actual = kojihub._applyQueryOpts(self.original, opts)
|
||||
actual = _applyQueryOpts(self.original, opts)
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
opts = {'countOnly': True, 'offset': 2}
|
||||
expected = 1
|
||||
actual = kojihub._applyQueryOpts(self.original, opts)
|
||||
actual = _applyQueryOpts(self.original, opts)
|
||||
self.assertEqual(expected, actual)
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ import mock
|
|||
class TestBuild(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
self.context.session.assertLogin = mock.MagicMock()
|
||||
self.context.session.hasPerm = mock.MagicMock()
|
||||
self.get_channel = mock.patch('kojihub.get_channel').start()
|
||||
self.make_task = mock.patch('kojihub.make_task').start()
|
||||
self.get_channel = mock.patch('kojihub.kojihub.get_channel').start()
|
||||
self.make_task = mock.patch('kojihub.kojihub.make_task').start()
|
||||
self.src = 'test-src'
|
||||
self.target = 'test-target'
|
||||
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ import mock
|
|||
class TestBuildImage(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
self.context.session.assertPerm = mock.MagicMock()
|
||||
self.context.session.hasPerm = mock.MagicMock()
|
||||
self.make_task = mock.patch('kojihub.make_task').start()
|
||||
self.make_task = mock.patch('kojihub.kojihub.make_task').start()
|
||||
self.mock_parse_arches = mock.patch('koji.parse_arches').start()
|
||||
self.name = 'image-name'
|
||||
self.version = 'test-version'
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import mock
|
|||
class TestBuildImageIndirection(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
self.context.session.assertPerm = mock.MagicMock()
|
||||
self.context.session.hasPerm = mock.MagicMock()
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import mock
|
|||
class TestBuildImageOz(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
self.context.session.assertPerm = mock.MagicMock()
|
||||
self.context.session.hasPerm = mock.MagicMock()
|
||||
|
|
|
|||
|
|
@ -19,14 +19,14 @@ class TestCGImporter(unittest.TestCase):
|
|||
os.mkdir(self.TMP_PATH)
|
||||
self.path_work = mock.patch('koji.pathinfo.work').start()
|
||||
self.context_db = mock.patch('koji.db.context').start()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.get_build = mock.patch('kojihub.get_build').start()
|
||||
self.get_user = mock.patch('kojihub.get_user').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.get_build = mock.patch('kojihub.kojihub.get_build').start()
|
||||
self.get_user = mock.patch('kojihub.kojihub.get_user').start()
|
||||
self.userinfo = {'id': 123}
|
||||
self.rmtree = mock.patch('koji.util.rmtree').start()
|
||||
self.lexists = mock.patch('os.path.lexists').start()
|
||||
self.path_build = mock.patch('koji.pathinfo.build').start()
|
||||
self.new_build = mock.patch('kojihub.new_build').start()
|
||||
self.new_build = mock.patch('kojihub.kojihub.new_build').start()
|
||||
|
||||
def tearDown(self):
|
||||
if os.path.exists(self.TMP_PATH):
|
||||
|
|
@ -166,7 +166,7 @@ class TestCGImporter(unittest.TestCase):
|
|||
x.get_metadata('default.json', 'cg_importer_json')
|
||||
x.import_metadata()
|
||||
|
||||
@mock.patch("kojihub.CG_Importer.get_metadata")
|
||||
@mock.patch("kojihub.kojihub.CG_Importer.get_metadata")
|
||||
def test_do_import_no_such_metadata(self, get_metadata):
|
||||
x = kojihub.CG_Importer()
|
||||
metadata = {'metadata_version': 99,
|
||||
|
|
@ -213,8 +213,8 @@ class TestMatchKojiFile(unittest.TestCase):
|
|||
'nvr': self.build1['nvr'],
|
||||
'filename': self.archive1['filename'],
|
||||
}
|
||||
self.get_archive = mock.patch('kojihub.get_archive').start()
|
||||
self.get_build = mock.patch('kojihub.get_build').start()
|
||||
self.get_archive = mock.patch('kojihub.kojihub.get_archive').start()
|
||||
self.get_build = mock.patch('kojihub.kojihub.get_build').start()
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
|
@ -264,9 +264,9 @@ class TestCGReservation(unittest.TestCase):
|
|||
return update
|
||||
|
||||
def setUp(self):
|
||||
self.InsertProcessor = mock.patch('kojihub.InsertProcessor',
|
||||
self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',
|
||||
side_effect=self.getInsert).start()
|
||||
self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',
|
||||
self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',
|
||||
side_effect=self.getUpdate).start()
|
||||
self.inserts = []
|
||||
self.updates = []
|
||||
|
|
@ -275,13 +275,14 @@ class TestCGReservation(unittest.TestCase):
|
|||
self.context_db.session.user_id = 123456
|
||||
self.mock_cursor = mock.MagicMock()
|
||||
self.context_db.cnx.cursor.return_value = self.mock_cursor
|
||||
self.get_build = mock.patch('kojihub.get_build').start()
|
||||
self.get_user = mock.patch('kojihub.get_user').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.get_build = mock.patch('kojihub.kojihub.get_build').start()
|
||||
self.get_user = mock.patch('kojihub.kojihub.get_user').start()
|
||||
self.userinfo = {'id': 123456, 'name': 'username'}
|
||||
self.new_build = mock.patch('kojihub.new_build').start()
|
||||
self.lookup_name = mock.patch('kojihub.lookup_name').start()
|
||||
self.assert_cg = mock.patch('kojihub.assert_cg').start()
|
||||
self.get_reservation_token = mock.patch('kojihub.get_reservation_token').start()
|
||||
self.new_build = mock.patch('kojihub.kojihub.new_build').start()
|
||||
self.lookup_name = mock.patch('kojihub.kojihub.lookup_name').start()
|
||||
self.assert_cg = mock.patch('kojihub.kojihub.assert_cg').start()
|
||||
self.get_reservation_token = mock.patch('kojihub.kojihub.get_reservation_token').start()
|
||||
self.run_callbacks = mock.patch('koji.plugin.run_callbacks').start()
|
||||
|
||||
def tearDown(self):
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ import mock
|
|||
class TestChainBuild(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
self.context.session.assertLogin = mock.MagicMock()
|
||||
self.context.session.hasPerm = mock.MagicMock()
|
||||
self.get_channel = mock.patch('kojihub.get_channel').start()
|
||||
self.make_task = mock.patch('kojihub.make_task').start()
|
||||
self.get_channel = mock.patch('kojihub.kojihub.get_channel').start()
|
||||
self.make_task = mock.patch('kojihub.kojihub.make_task').start()
|
||||
self.srcs = ['pkg1']
|
||||
self.target = 'test-target'
|
||||
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ import mock
|
|||
class TestChainMaven(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
self.context.session.assertLogin = mock.MagicMock()
|
||||
self.context.session.hasPerm = mock.MagicMock()
|
||||
self.get_channel = mock.patch('kojihub.get_channel').start()
|
||||
self.make_task = mock.patch('kojihub.make_task').start()
|
||||
self.get_channel = mock.patch('kojihub.kojihub.get_channel').start()
|
||||
self.make_task = mock.patch('kojihub.kojihub.make_task').start()
|
||||
self.builds = {'build1': {}, 'build2': {}, 'build3': {}}
|
||||
self.target = 'test-target'
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import unittest
|
|||
import koji
|
||||
import koji.policy
|
||||
import kojihub
|
||||
import kojixmlrpc
|
||||
from kojihub import kojixmlrpc
|
||||
|
||||
|
||||
class OurException(Exception):
|
||||
|
|
@ -23,8 +23,8 @@ class FakePlugin(object):
|
|||
class TestCheckVolumePolicy(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.lookup_name = mock.patch('kojihub.lookup_name').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.lookup_name = mock.patch('kojihub.kojihub.lookup_name').start()
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
|
|
|||
|
|
@ -53,21 +53,21 @@ class TestCompleteImageBuild(unittest.TestCase):
|
|||
mock.patch('koji.pathinfo', new=self.pathinfo).start()
|
||||
self.hostcalls = kojihub.HostExports()
|
||||
self.context_db = mock.patch('koji.db.context').start()
|
||||
mock.patch('kojihub.Host').start()
|
||||
self.Task = mock.patch('kojihub.Task').start()
|
||||
mock.patch('kojihub.kojihub.Host').start()
|
||||
self.Task = mock.patch('kojihub.kojihub.Task').start()
|
||||
self.Task.return_value.assertHost = mock.MagicMock()
|
||||
self.get_build = mock.patch('kojihub.get_build').start()
|
||||
mock.patch('kojihub.get_rpm', new=self.my_get_rpm).start()
|
||||
self.get_image_build = mock.patch('kojihub.get_image_build').start()
|
||||
mock.patch('kojihub.get_archive_type', new=self.my_get_archive_type).start()
|
||||
mock.patch('kojihub.lookup_name', new=self.my_lookup_name).start()
|
||||
self.get_build = mock.patch('kojihub.kojihub.get_build').start()
|
||||
mock.patch('kojihub.kojihub.get_rpm', new=self.my_get_rpm).start()
|
||||
self.get_image_build = mock.patch('kojihub.kojihub.get_image_build').start()
|
||||
mock.patch('kojihub.kojihub.get_archive_type', new=self.my_get_archive_type).start()
|
||||
mock.patch('kojihub.kojihub.lookup_name', new=self.my_lookup_name).start()
|
||||
mock.patch.object(kojihub.BuildRoot, 'load', new=self.my_buildroot_load).start()
|
||||
mock.patch('kojihub.import_archive_internal',
|
||||
mock.patch('kojihub.kojihub.import_archive_internal',
|
||||
new=self.my_import_archive_internal).start()
|
||||
self._dml = mock.patch('kojihub._dml').start()
|
||||
mock.patch('kojihub.build_notification').start()
|
||||
mock.patch('kojihub.assert_policy').start()
|
||||
mock.patch('kojihub.check_volume_policy',
|
||||
self._dml = mock.patch('kojihub.kojihub._dml').start()
|
||||
mock.patch('kojihub.kojihub.build_notification').start()
|
||||
mock.patch('kojihub.kojihub.assert_policy').start()
|
||||
mock.patch('kojihub.kojihub.check_volume_policy',
|
||||
return_value={'id': 0, 'name': 'DEFAULT'}).start()
|
||||
self.set_up_callbacks()
|
||||
self.rpms = {}
|
||||
|
|
@ -79,7 +79,7 @@ class TestCompleteImageBuild(unittest.TestCase):
|
|||
new=make_bulk_insert_grabber(self)).start()
|
||||
mock.patch.object(kojihub.UpdateProcessor, 'execute',
|
||||
new=make_update_grabber(self)).start()
|
||||
mock.patch('kojihub.nextval', new=self.my_nextval).start()
|
||||
mock.patch('kojihub.kojihub.nextval', new=self.my_nextval).start()
|
||||
self.sequences = {}
|
||||
|
||||
def tearDown(self):
|
||||
|
|
@ -173,8 +173,8 @@ class TestCompleteImageBuild(unittest.TestCase):
|
|||
|
||||
def my_ga(archive_id, **kw):
|
||||
return share['archiveinfo']
|
||||
with mock.patch('kojihub.InsertProcessor', new=my_ip):
|
||||
with mock.patch('kojihub.get_archive', new=my_ga):
|
||||
with mock.patch('kojihub.kojihub.InsertProcessor', new=my_ip):
|
||||
with mock.patch('kojihub.kojihub.get_archive', new=my_ga):
|
||||
return orig_import_archive_internal(*a, **kw)
|
||||
|
||||
def set_up_callbacks(self):
|
||||
|
|
|
|||
|
|
@ -21,24 +21,24 @@ class TestCompleteMavenBuild(unittest.TestCase):
|
|||
self.pathinfo = koji.PathInfo(self.tempdir)
|
||||
mock.patch('koji.pathinfo', new=self.pathinfo).start()
|
||||
self.hostcalls = kojihub.HostExports()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.context_db = mock.patch('koji.db.context').start()
|
||||
self.context.opts = {'EnableMaven': True}
|
||||
mock.patch('kojihub.Host').start()
|
||||
self.Task = mock.patch('kojihub.Task').start()
|
||||
mock.patch('kojihub.kojihub.Host').start()
|
||||
self.Task = mock.patch('kojihub.kojihub.Task').start()
|
||||
self.Task.return_value.assertHost = mock.MagicMock()
|
||||
self.get_build = mock.patch('kojihub.get_build').start()
|
||||
self.get_maven_build = mock.patch('kojihub.get_maven_build').start()
|
||||
self.get_archive_type = mock.patch('kojihub.get_archive_type').start()
|
||||
mock.patch('kojihub.lookup_name', new=self.my_lookup_name).start()
|
||||
self.get_build = mock.patch('kojihub.kojihub.get_build').start()
|
||||
self.get_maven_build = mock.patch('kojihub.kojihub.get_maven_build').start()
|
||||
self.get_archive_type = mock.patch('kojihub.kojihub.get_archive_type').start()
|
||||
mock.patch('kojihub.kojihub.lookup_name', new=self.my_lookup_name).start()
|
||||
mock.patch.object(kojihub.BuildRoot, 'load', new=self.my_buildroot_load).start()
|
||||
mock.patch('kojihub.import_archive_internal',
|
||||
mock.patch('kojihub.kojihub.import_archive_internal',
|
||||
new=self.my_import_archive_internal).start()
|
||||
mock.patch('koji.db._dml').start()
|
||||
mock.patch('koji.db._fetchSingle').start()
|
||||
mock.patch('kojihub.build_notification').start()
|
||||
mock.patch('kojihub.assert_policy').start()
|
||||
mock.patch('kojihub.check_volume_policy',
|
||||
mock.patch('kojihub.kojihub.build_notification').start()
|
||||
mock.patch('kojihub.kojihub.assert_policy').start()
|
||||
mock.patch('kojihub.kojihub.check_volume_policy',
|
||||
return_value={'id': 0, 'name': 'DEFAULT'}).start()
|
||||
self.set_up_callbacks()
|
||||
|
||||
|
|
@ -96,8 +96,8 @@ class TestCompleteMavenBuild(unittest.TestCase):
|
|||
|
||||
def my_ga(archive_id, **kw):
|
||||
return share['archiveinfo']
|
||||
with mock.patch('kojihub.InsertProcessor', new=my_ip):
|
||||
with mock.patch('kojihub.get_archive', new=my_ga):
|
||||
with mock.patch('kojihub.kojihub.InsertProcessor', new=my_ip):
|
||||
with mock.patch('kojihub.kojihub.get_archive', new=my_ga):
|
||||
orig_import_archive_internal(*a, **kw)
|
||||
|
||||
def set_up_callbacks(self):
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ import kojihub
|
|||
class TestCreateExternalRepo(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.get_external_repos = mock.patch('kojihub.get_external_repos').start()
|
||||
self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.get_external_repos = mock.patch('kojihub.kojihub.get_external_repos').start()
|
||||
self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
# It seems MagicMock will not automatically handle attributes that
|
||||
# start with "assert"
|
||||
self.context.session.assertPerm = mock.MagicMock()
|
||||
|
|
|
|||
|
|
@ -29,23 +29,23 @@ class TestCreateNotification(unittest.TestCase):
|
|||
return update
|
||||
|
||||
def setUp(self):
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.context.opts = {
|
||||
'EmailDomain': 'test.domain.com',
|
||||
'NotifyOnSuccess': True,
|
||||
}
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.InsertProcessor = mock.patch('kojihub.InsertProcessor',
|
||||
self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',
|
||||
side_effect=self.getInsert).start()
|
||||
self.inserts = []
|
||||
self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',
|
||||
self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',
|
||||
side_effect=self.getUpdate).start()
|
||||
self.updates = []
|
||||
self.get_build_notifications = mock.patch('kojihub.get_build_notifications').start()
|
||||
self.get_tag_id = mock.patch('kojihub.get_tag_id').start()
|
||||
self.get_package_id = mock.patch('kojihub.get_package_id').start()
|
||||
self.get_build_notifications = mock.patch('kojihub.kojihub.get_build_notifications').start()
|
||||
self.get_tag_id = mock.patch('kojihub.kojihub.get_tag_id').start()
|
||||
self.get_package_id = mock.patch('kojihub.kojihub.get_package_id').start()
|
||||
|
||||
self.exports = kojihub.RootExports()
|
||||
self.exports.getLoggedInUser = mock.MagicMock()
|
||||
|
|
|
|||
|
|
@ -29,25 +29,25 @@ class TestCreateNotificationBlock(unittest.TestCase):
|
|||
return update
|
||||
|
||||
def setUp(self):
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.context.opts = {
|
||||
'EmailDomain': 'test.domain.com',
|
||||
'NotifyOnSuccess': True,
|
||||
}
|
||||
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.InsertProcessor = mock.patch('kojihub.InsertProcessor',
|
||||
self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',
|
||||
side_effect=self.getInsert).start()
|
||||
self.inserts = []
|
||||
self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',
|
||||
self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',
|
||||
side_effect=self.getUpdate).start()
|
||||
self.updates = []
|
||||
self.get_tag_id = mock.patch('kojihub.get_tag_id').start()
|
||||
self.get_package_id = mock.patch('kojihub.get_package_id').start()
|
||||
self.get_tag_id = mock.patch('kojihub.kojihub.get_tag_id').start()
|
||||
self.get_package_id = mock.patch('kojihub.kojihub.get_package_id').start()
|
||||
self.get_build_notification_blocks = mock.patch(
|
||||
'kojihub.get_build_notification_blocks').start()
|
||||
'kojihub.kojihub.get_build_notification_blocks').start()
|
||||
|
||||
self.exports = kojihub.RootExports()
|
||||
self.exports.getLoggedInUser = mock.MagicMock()
|
||||
|
|
|
|||
|
|
@ -18,16 +18,16 @@ class TestCreateTag(unittest.TestCase):
|
|||
return insert
|
||||
|
||||
def setUp(self):
|
||||
self.InsertProcessor = mock.patch('kojihub.InsertProcessor',
|
||||
self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',
|
||||
side_effect=self.getInsert).start()
|
||||
self.inserts = []
|
||||
self._dml = mock.patch('kojihub._dml').start()
|
||||
self.get_tag = mock.patch('kojihub.get_tag').start()
|
||||
self.get_tag_id = mock.patch('kojihub.get_tag_id').start()
|
||||
self.get_perm_id = mock.patch('kojihub.get_perm_id').start()
|
||||
self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()
|
||||
self.writeInheritanceData = mock.patch('kojihub._writeInheritanceData').start()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self._dml = mock.patch('kojihub.kojihub._dml').start()
|
||||
self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()
|
||||
self.get_tag_id = mock.patch('kojihub.kojihub.get_tag_id').start()
|
||||
self.get_perm_id = mock.patch('kojihub.kojihub.get_perm_id').start()
|
||||
self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()
|
||||
self.writeInheritanceData = mock.patch('kojihub.kojihub._writeInheritanceData').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.context_db = mock.patch('koji.db.context').start()
|
||||
# It seems MagicMock will not automatically handle attributes that
|
||||
# start with "assert"
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ import kojihub
|
|||
class TestCreateUser(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.verify_name_user = mock.patch('kojihub.verify_name_user').start()
|
||||
self.get_user = mock.patch('kojihub.get_user').start()
|
||||
self.get_user_by_krb_principal = mock.patch('kojihub.get_user_by_krb_principal').start()
|
||||
self.verify_name_user = mock.patch('kojihub.kojihub.verify_name_user').start()
|
||||
self.get_user = mock.patch('kojihub.kojihub.get_user').start()
|
||||
self.get_user_by_krb_principal = mock.patch('kojihub.kojihub.get_user_by_krb_principal').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
# It seems MagicMock will not automatically handle attributes that
|
||||
# start with "assert"
|
||||
self.context.session.assertPerm = mock.MagicMock()
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@ IP = kojihub.InsertProcessor
|
|||
class TestCreateWinBuild(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.get_build = mock.patch('kojihub.get_build').start()
|
||||
self.get_build = mock.patch('kojihub.kojihub.get_build').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
self.session = mock.MagicMock()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.context.session.assertPerm = mock.MagicMock()
|
||||
self.InsertProcessor = mock.patch('kojihub.InsertProcessor',
|
||||
self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',
|
||||
side_effect=self.getInsert).start()
|
||||
self.inserts = []
|
||||
self.insert_execute = mock.MagicMock()
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ import kojihub
|
|||
|
||||
class TestDeleteBuild(unittest.TestCase):
|
||||
|
||||
@mock.patch('kojihub.context')
|
||||
@mock.patch('kojihub.get_build')
|
||||
@mock.patch('kojihub.kojihub.context')
|
||||
@mock.patch('kojihub.kojihub.get_build')
|
||||
def test_delete_build_raise_error(self, build, context):
|
||||
context.session.assertPerm = mock.MagicMock()
|
||||
references = ['tags', 'rpms', 'archives', 'component_of']
|
||||
|
|
@ -18,15 +18,15 @@ class TestDeleteBuild(unittest.TestCase):
|
|||
context = mock.MagicMock()
|
||||
context.session.return_value = context
|
||||
|
||||
with mock.patch('kojihub.build_references') as refs:
|
||||
with mock.patch('kojihub.kojihub.build_references') as refs:
|
||||
retval = defaultdict(dict)
|
||||
retval[ref] = True
|
||||
refs.return_value = retval
|
||||
with self.assertRaises(koji.GenericError):
|
||||
kojihub.delete_build(build='', strict=True)
|
||||
|
||||
@mock.patch('kojihub.context')
|
||||
@mock.patch('kojihub.get_build')
|
||||
@mock.patch('kojihub.kojihub.context')
|
||||
@mock.patch('kojihub.kojihub.get_build')
|
||||
def test_delete_build_return_false(self, build, context):
|
||||
context.session.assertPerm = mock.MagicMock()
|
||||
references = ['tags', 'rpms', 'archives', 'component_of']
|
||||
|
|
@ -34,14 +34,14 @@ class TestDeleteBuild(unittest.TestCase):
|
|||
context = mock.MagicMock()
|
||||
context.session.return_value = context
|
||||
|
||||
with mock.patch('kojihub.build_references') as refs:
|
||||
with mock.patch('kojihub.kojihub.build_references') as refs:
|
||||
retval = defaultdict(dict)
|
||||
retval[ref] = True
|
||||
refs.return_value = retval
|
||||
assert kojihub.delete_build(build='', strict=False) is False
|
||||
|
||||
@mock.patch('kojihub.context')
|
||||
@mock.patch('kojihub.get_build')
|
||||
@mock.patch('kojihub.kojihub.context')
|
||||
@mock.patch('kojihub.kojihub.get_build')
|
||||
def test_delete_build_check_last_used_raise_error(self, build, context):
|
||||
context.session.assertPerm = mock.MagicMock()
|
||||
references = ['tags', 'rpms', 'archives', 'component_of', 'last_used']
|
||||
|
|
@ -49,18 +49,18 @@ class TestDeleteBuild(unittest.TestCase):
|
|||
context = mock.MagicMock()
|
||||
context.session.return_value = context
|
||||
|
||||
with mock.patch('kojihub.build_references') as refs:
|
||||
with mock.patch('kojihub.kojihub.build_references') as refs:
|
||||
retval = defaultdict(dict)
|
||||
if ref == 'last_used':
|
||||
retval[ref] = time.time() + 100
|
||||
refs.return_value = retval
|
||||
self.assertFalse(kojihub.delete_build(build='', strict=False))
|
||||
|
||||
@mock.patch('kojihub.get_user')
|
||||
@mock.patch('kojihub._delete_build')
|
||||
@mock.patch('kojihub.build_references')
|
||||
@mock.patch('kojihub.context')
|
||||
@mock.patch('kojihub.get_build')
|
||||
@mock.patch('kojihub.kojihub.get_user')
|
||||
@mock.patch('kojihub.kojihub._delete_build')
|
||||
@mock.patch('kojihub.kojihub.build_references')
|
||||
@mock.patch('kojihub.kojihub.context')
|
||||
@mock.patch('kojihub.kojihub.get_build')
|
||||
def test_delete_build_lazy_refs(self, build, context, buildrefs, _delete, get_user):
|
||||
'''Test that we can handle lazy return from build_references'''
|
||||
get_user.return_value = {'authtype': 2, 'id': 1, 'krb_principal': None,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import kojihub
|
|||
class TestDeleteBuildTarget(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.lookup_name = mock.patch('kojihub.lookup_name').start()
|
||||
self.lookup_name = mock.patch('kojihub.kojihub.lookup_name').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
|
||||
def test_non_exist_target(self):
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ class TestDeleteNotifications(unittest.TestCase):
|
|||
return delete
|
||||
|
||||
def setUp(self):
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.context.opts = {
|
||||
'EmailDomain': 'test.domain.com',
|
||||
'NotifyOnSuccess': True,
|
||||
}
|
||||
self.DeleteProcessor = mock.patch('kojihub.DeleteProcessor',
|
||||
self.DeleteProcessor = mock.patch('kojihub.kojihub.DeleteProcessor',
|
||||
side_effect=self.getDelete).start()
|
||||
self.deletes = []
|
||||
|
||||
|
|
|
|||
|
|
@ -15,16 +15,16 @@ class TestDeleteNotificationsBlocks(unittest.TestCase):
|
|||
return delete
|
||||
|
||||
def setUp(self):
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.context.opts = {
|
||||
'EmailDomain': 'test.domain.com',
|
||||
'NotifyOnSuccess': True,
|
||||
}
|
||||
|
||||
self.DeleteProcessor = mock.patch('kojihub.DeleteProcessor',
|
||||
self.DeleteProcessor = mock.patch('kojihub.kojihub.DeleteProcessor',
|
||||
side_effect=self.getDelete).start()
|
||||
self.deletes = []
|
||||
self.get_user = mock.patch('kojihub.get_user').start()
|
||||
self.get_user = mock.patch('kojihub.kojihub.get_user').start()
|
||||
|
||||
self.exports = kojihub.RootExports()
|
||||
self.exports.getLoggedInUser = mock.MagicMock()
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@ class TestDeleteRPMSig(unittest.TestCase):
|
|||
return delete
|
||||
|
||||
def setUp(self):
|
||||
self.DeleteProcessor = mock.patch('kojihub.DeleteProcessor',
|
||||
self.DeleteProcessor = mock.patch('kojihub.kojihub.DeleteProcessor',
|
||||
side_effect=self.getDelete).start()
|
||||
self.deletes = []
|
||||
self.get_rpm = mock.patch('kojihub.get_rpm').start()
|
||||
self.query_rpm_sigs = mock.patch('kojihub.query_rpm_sigs').start()
|
||||
self.get_build = mock.patch('kojihub.get_build').start()
|
||||
self.get_user = mock.patch('kojihub.get_user').start()
|
||||
self.get_rpm = mock.patch('kojihub.kojihub.get_rpm').start()
|
||||
self.query_rpm_sigs = mock.patch('kojihub.kojihub.query_rpm_sigs').start()
|
||||
self.get_build = mock.patch('kojihub.kojihub.get_build').start()
|
||||
self.get_user = mock.patch('kojihub.kojihub.get_user').start()
|
||||
self.buildinfo = {'build_id': 1,
|
||||
'epoch': None,
|
||||
'extra': None,
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ class TestDeleteTag(unittest.TestCase):
|
|||
return update
|
||||
|
||||
def setUp(self):
|
||||
self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',
|
||||
self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',
|
||||
side_effect=self.getUpdate).start()
|
||||
self.updates = []
|
||||
self.get_tag = mock.patch('kojihub.get_tag').start()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.context_db = mock.patch('koji.db.context').start()
|
||||
# It seems MagicMock will not automatically handle attributes that
|
||||
# start with "assert"
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ class TestDisableChannel(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
self.exports = kojihub.RootExports()
|
||||
self.get_channel = mock.patch('kojihub.get_channel').start()
|
||||
self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',
|
||||
self.get_channel = mock.patch('kojihub.kojihub.get_channel').start()
|
||||
self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',
|
||||
side_effect=self.getUpdate).start()
|
||||
self.updates = []
|
||||
self.channelname = 'test-channel'
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class TestDisableUser(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
self.exports = kojihub.RootExports()
|
||||
self.get_user = mock.patch('kojihub.get_user').start()
|
||||
self.get_user = mock.patch('kojihub.kojihub.get_user').start()
|
||||
|
||||
def test_non_exist_user(self):
|
||||
username = 'test-user'
|
||||
|
|
|
|||
|
|
@ -23,15 +23,15 @@ class TestDistRepoInit(unittest.TestCase):
|
|||
self.pathinfo = koji.PathInfo(self.tempdir)
|
||||
mock.patch('koji.pathinfo', new=self.pathinfo).start()
|
||||
|
||||
self.InsertProcessor = mock.patch('kojihub.InsertProcessor',
|
||||
self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',
|
||||
side_effect=self.getInsert).start()
|
||||
self.inserts = []
|
||||
|
||||
self.get_tag = mock.patch('kojihub.get_tag').start()
|
||||
self.get_event = mock.patch('kojihub.get_event').start()
|
||||
self.nextval = mock.patch('kojihub.nextval').start()
|
||||
self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()
|
||||
self.get_event = mock.patch('kojihub.kojihub.get_event').start()
|
||||
self.nextval = mock.patch('kojihub.kojihub.nextval').start()
|
||||
self.copyfile = mock.patch('shutil.copyfile').start()
|
||||
self.lookup_name = mock.patch('kojihub.lookup_name').start()
|
||||
self.lookup_name = mock.patch('kojihub.kojihub.lookup_name').start()
|
||||
|
||||
self.get_tag.return_value = {'id': 42, 'name': 'tag'}
|
||||
self.get_event.return_value = 12345
|
||||
|
|
@ -105,9 +105,9 @@ class TestDistRepoInit(unittest.TestCase):
|
|||
|
||||
class TestDistRepo(unittest.TestCase):
|
||||
|
||||
@mock.patch('kojihub.assert_policy')
|
||||
@mock.patch('kojihub.dist_repo_init')
|
||||
@mock.patch('kojihub.make_task')
|
||||
@mock.patch('kojihub.kojihub.assert_policy')
|
||||
@mock.patch('kojihub.kojihub.dist_repo_init')
|
||||
@mock.patch('kojihub.kojihub.make_task')
|
||||
def test_DistRepo(self, make_task, dist_repo_init, assert_policy):
|
||||
session = kojihub.context.session = mock.MagicMock()
|
||||
session.user_id = 123
|
||||
|
|
@ -210,10 +210,10 @@ class TestDistRepoMove(unittest.TestCase):
|
|||
koji.dump_json("%s/repo_manifest" % uploaddir, self.files)
|
||||
|
||||
# mocks
|
||||
self.repo_info = mock.patch('kojihub.repo_info').start()
|
||||
self.repo_info = mock.patch('kojihub.kojihub.repo_info').start()
|
||||
self.repo_info.return_value = self.rinfo.copy()
|
||||
self.get_rpm = mock.patch('kojihub.get_rpm').start()
|
||||
self.get_build = mock.patch('kojihub.get_build').start()
|
||||
self.get_rpm = mock.patch('kojihub.kojihub.get_rpm').start()
|
||||
self.get_build = mock.patch('kojihub.kojihub.get_build').start()
|
||||
self.get_rpm.side_effect = self.our_get_rpm
|
||||
self.get_build.side_effect = self.our_get_build
|
||||
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ class TestEditBuildTarget(unittest.TestCase):
|
|||
return query
|
||||
|
||||
def setUp(self):
|
||||
self.lookup_build_target = mock.patch('kojihub.lookup_build_target').start()
|
||||
self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()
|
||||
self.get_tag = mock.patch('kojihub.get_tag').start()
|
||||
self.lookup_build_target = mock.patch('kojihub.kojihub.lookup_build_target').start()
|
||||
self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()
|
||||
self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
self.target_name = 'build-target'
|
||||
self.name = 'build-target-rename'
|
||||
|
|
@ -32,7 +32,7 @@ class TestEditBuildTarget(unittest.TestCase):
|
|||
self.dest_tag_info = {'id': 112, 'name': self.dest_tag}
|
||||
self.session = kojihub.context.session = mock.MagicMock()
|
||||
self.session.assertPerm = mock.MagicMock()
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.query_singleValue = mock.MagicMock()
|
||||
|
|
|
|||
|
|
@ -23,21 +23,21 @@ class TestEditChannel(unittest.TestCase):
|
|||
return update
|
||||
|
||||
def setUp(self):
|
||||
self.InsertProcessor = mock.patch('kojihub.InsertProcessor',
|
||||
self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',
|
||||
side_effect=self.getInsert).start()
|
||||
self.inserts = []
|
||||
self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',
|
||||
self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',
|
||||
side_effect=self.getUpdate).start()
|
||||
self.updates = []
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.context.session.assertPerm = mock.MagicMock()
|
||||
self.exports = kojihub.RootExports()
|
||||
self.channel_name = 'test-channel'
|
||||
self.channel_name_new = 'test-channel-2'
|
||||
self.channel_info = {'id': 123, 'name': self.channel_name, 'description': 'description',
|
||||
'comment': 'comment'}
|
||||
self.get_channel = mock.patch('kojihub.get_channel').start()
|
||||
self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()
|
||||
self.get_channel = mock.patch('kojihub.kojihub.get_channel').start()
|
||||
self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
|
@ -74,7 +74,7 @@ class TestEditChannel(unittest.TestCase):
|
|||
|
||||
def test_edit_channel_valid(self):
|
||||
self.verify_name_internal.return_value = None
|
||||
kojihub.get_channel.side_effect = [self.channel_info, {}]
|
||||
self.get_channel.side_effect = [self.channel_info, {}]
|
||||
|
||||
r = self.exports.editChannel(self.channel_name, name=self.channel_name_new,
|
||||
description='description_new')
|
||||
|
|
@ -108,7 +108,7 @@ class TestEditChannel(unittest.TestCase):
|
|||
|
||||
def test_edit_channel_no_change(self):
|
||||
self.verify_name_internal.return_value = None
|
||||
kojihub.get_channel.return_value = self.channel_info
|
||||
self.get_channel.return_value = self.channel_info
|
||||
|
||||
r = self.exports.editChannel(self.channel_name, description='description')
|
||||
self.assertFalse(r)
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ import kojihub
|
|||
class TestEditExternalRepo(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.get_external_repo = mock.patch('kojihub.get_external_repo').start()
|
||||
self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.get_external_repo = mock.patch('kojihub.kojihub.get_external_repo').start()
|
||||
self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
# It seems MagicMock will not automatically handle attributes that
|
||||
# start with "assert"
|
||||
self.context.session.assertPerm = mock.MagicMock()
|
||||
|
|
|
|||
|
|
@ -23,20 +23,20 @@ class TestEditHost(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
self.diff = None
|
||||
self.InsertProcessor = mock.patch('kojihub.InsertProcessor',
|
||||
self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',
|
||||
side_effect=self.getInsert).start()
|
||||
self.inserts = []
|
||||
self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',
|
||||
self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',
|
||||
side_effect=self.getUpdate).start()
|
||||
self.updates = []
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.context_db = mock.patch('koji.db.context').start()
|
||||
# It seems MagicMock will not automatically handle attributes that
|
||||
# start with "assert"
|
||||
self.context_db.session.assertLogin = mock.MagicMock()
|
||||
self.context.session.assertPerm = mock.MagicMock()
|
||||
self.exports = kojihub.RootExports()
|
||||
self.get_host = mock.patch('kojihub.get_host').start()
|
||||
self.get_host = mock.patch('kojihub.kojihub.get_host').start()
|
||||
self.hostinfo = {
|
||||
'id': 123,
|
||||
'user_id': 234,
|
||||
|
|
@ -52,49 +52,48 @@ class TestEditHost(unittest.TestCase):
|
|||
mock.patch.stopall()
|
||||
|
||||
def test_edit_host_missing(self):
|
||||
kojihub.get_host.side_effect = koji.GenericError
|
||||
self.get_host.side_effect = koji.GenericError
|
||||
with self.assertRaises(koji.GenericError):
|
||||
self.exports.editHost('hostname')
|
||||
kojihub.get_host.assert_called_once_with('hostname', strict=True)
|
||||
self.get_host.assert_called_once_with('hostname', strict=True)
|
||||
self.assertEqual(self.inserts, [])
|
||||
self.assertEqual(self.updates, [])
|
||||
|
||||
def test_edit_host_invalid_description(self):
|
||||
description = ['description']
|
||||
kojihub.get_host.return_value = self.hostinfo
|
||||
self.get_host.return_value = self.hostinfo
|
||||
with self.assertRaises(koji.ParameterError) as ex:
|
||||
self.exports.editHost('hostname', description=description)
|
||||
self.assertEqual('Invalid type for description parameter: %s' % type(description),
|
||||
str(ex.exception))
|
||||
kojihub.get_host.assert_called_once_with('hostname', strict=True)
|
||||
self.get_host.assert_called_once_with('hostname', strict=True)
|
||||
self.assertEqual(self.inserts, [])
|
||||
self.assertEqual(self.updates, [])
|
||||
|
||||
def test_edit_host_invalid_comment_parameter(self):
|
||||
comment = ['comment']
|
||||
kojihub.get_host.return_value = self.hostinfo
|
||||
self.get_host.return_value = self.hostinfo
|
||||
with self.assertRaises(koji.ParameterError) as ex:
|
||||
self.exports.editHost('hostname', comment=comment)
|
||||
self.assertEqual('Invalid type for comment parameter: %s' % type(comment),
|
||||
str(ex.exception))
|
||||
kojihub.get_host.assert_called_once_with('hostname', strict=True)
|
||||
self.get_host.assert_called_once_with('hostname', strict=True)
|
||||
self.assertEqual(self.inserts, [])
|
||||
self.assertEqual(self.updates, [])
|
||||
|
||||
def test_edit_host_invalid_arches_parameter(self):
|
||||
arches = ['arches arches']
|
||||
kojihub.get_host.return_value = self.hostinfo
|
||||
self.get_host.return_value = self.hostinfo
|
||||
with self.assertRaises(koji.ParameterError) as ex:
|
||||
self.exports.editHost('hostname', arches=arches)
|
||||
self.assertEqual('Invalid type for arches parameter: %s' % type(arches),
|
||||
str(ex.exception))
|
||||
kojihub.get_host.assert_called_once_with('hostname', strict=True)
|
||||
self.get_host.assert_called_once_with('hostname', strict=True)
|
||||
self.assertEqual(self.inserts, [])
|
||||
self.assertEqual(self.updates, [])
|
||||
|
||||
def test_edit_host_valid(self):
|
||||
kojihub.get_host = mock.MagicMock()
|
||||
kojihub.get_host.return_value = self.hostinfo
|
||||
self.get_host.return_value = self.hostinfo
|
||||
self.context_db.event_id = 42
|
||||
self.context_db.session.user_id = 23
|
||||
|
||||
|
|
@ -102,11 +101,11 @@ class TestEditHost(unittest.TestCase):
|
|||
comment='comment_new', non_existing_kw='bogus')
|
||||
|
||||
self.assertTrue(r)
|
||||
kojihub.get_host.assert_called_once_with('hostname', strict=True)
|
||||
self.get_host.assert_called_once_with('hostname', strict=True)
|
||||
|
||||
# revoke
|
||||
self.assertEqual(len(self.updates), 1)
|
||||
values = kojihub.get_host.return_value
|
||||
values = self.get_host.return_value
|
||||
clauses = ['host_id = %(id)i', 'active = TRUE']
|
||||
revoke_data = {
|
||||
'revoke_event': 42,
|
||||
|
|
@ -139,15 +138,14 @@ class TestEditHost(unittest.TestCase):
|
|||
self.assertEqual(insert.rawdata, rawdata)
|
||||
|
||||
def test_edit_host_no_change(self):
|
||||
kojihub.get_host = mock.MagicMock()
|
||||
kojihub.get_host.return_value = self.hostinfo
|
||||
self.get_host.return_value = self.hostinfo
|
||||
self.context_db.event_id = 42
|
||||
self.context_db.session.user_id = 23
|
||||
|
||||
r = self.exports.editHost('hostname')
|
||||
|
||||
self.assertFalse(r)
|
||||
kojihub.get_host.assert_called_once_with('hostname', strict=True)
|
||||
self.get_host.assert_called_once_with('hostname', strict=True)
|
||||
|
||||
self.assertEqual(len(self.updates), 0)
|
||||
self.assertEqual(len(self.inserts), 0)
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ UP = kojihub.UpdateProcessor
|
|||
class TestEditPermission(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.lookup_perm = mock.patch('kojihub.lookup_perm').start()
|
||||
self.update_processor = mock.patch('kojihub.UpdateProcessor').start()
|
||||
self.lookup_perm = mock.patch('kojihub.kojihub.lookup_perm').start()
|
||||
self.update_processor = mock.patch('kojihub.kojihub.UpdateProcessor').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
# It seems MagicMock will not automatically handle attributes that
|
||||
# start with "assert"
|
||||
self.context.session.assertPerm = mock.MagicMock()
|
||||
|
|
|
|||
|
|
@ -33,21 +33,21 @@ class TestEditTag(unittest.TestCase):
|
|||
return query
|
||||
|
||||
def setUp(self):
|
||||
self.InsertProcessor = mock.patch('kojihub.InsertProcessor',
|
||||
self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',
|
||||
side_effect=self.getInsert).start()
|
||||
self.inserts = []
|
||||
self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',
|
||||
self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',
|
||||
side_effect=self.getUpdate).start()
|
||||
self.updates = []
|
||||
self.get_tag = mock.patch('kojihub.get_tag').start()
|
||||
self.get_perm_id = mock.patch('kojihub.get_perm_id').start()
|
||||
self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()
|
||||
self.get_perm_id = mock.patch('kojihub.kojihub.get_perm_id').start()
|
||||
self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.context_db = mock.patch('koji.db.context').start()
|
||||
# It seems MagicMock will not automatically handle attributes that
|
||||
# start with "assert"
|
||||
self.context_db.session.assertLogin = mock.MagicMock()
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.query_singleValue = mock.MagicMock()
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ import kojihub
|
|||
class TestEditTagExternalRepo(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.context.session.assertPerm = mock.MagicMock()
|
||||
self.get_tag = mock.patch('kojihub.get_tag').start()
|
||||
self.get_external_repo = mock.patch('kojihub.get_external_repo').start()
|
||||
self.get_tag_external_repos = mock.patch('kojihub.get_tag_external_repos').start()
|
||||
self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()
|
||||
self.get_external_repo = mock.patch('kojihub.kojihub.get_external_repo').start()
|
||||
self.get_tag_external_repos = mock.patch('kojihub.kojihub.get_tag_external_repos').start()
|
||||
self.get_tag.return_value = {'id': 1, 'name': 'tag'}
|
||||
self.get_external_repo.return_value = {'id': 11, 'name': 'ext_repo'}
|
||||
self.get_tag_external_repos.return_value = [{'external_repo_id': 11,
|
||||
|
|
@ -22,8 +22,8 @@ class TestEditTagExternalRepo(unittest.TestCase):
|
|||
'arches': 'x86_64 i686'}]
|
||||
|
||||
self.remove_external_repo_from_tag = mock.patch(
|
||||
'kojihub.remove_external_repo_from_tag').start()
|
||||
self.add_external_repo_to_tag = mock.patch('kojihub.add_external_repo_to_tag').start()
|
||||
'kojihub.kojihub.remove_external_repo_from_tag').start()
|
||||
self.add_external_repo_to_tag = mock.patch('kojihub.kojihub.add_external_repo_to_tag').start()
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
|
|
|||
|
|
@ -27,15 +27,15 @@ class TestEditUser(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
self.updates = []
|
||||
self.get_user = mock.patch('kojihub.get_user').start()
|
||||
self.verify_name_user = mock.patch('kojihub.verify_name_user').start()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',
|
||||
self.get_user = mock.patch('kojihub.kojihub.get_user').start()
|
||||
self.verify_name_user = mock.patch('kojihub.kojihub.verify_name_user').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',
|
||||
side_effect=self.getUpdate).start()
|
||||
# It seems MagicMock will not automatically handle attributes that
|
||||
# start with "assert"
|
||||
self.context.session.assertLogin = mock.MagicMock()
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.query_singleValue = mock.MagicMock()
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ class TestEnableChannel(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
self.exports = kojihub.RootExports()
|
||||
self.get_channel = mock.patch('kojihub.get_channel').start()
|
||||
self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',
|
||||
self.get_channel = mock.patch('kojihub.kojihub.get_channel').start()
|
||||
self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',
|
||||
side_effect=self.getUpdate).start()
|
||||
self.updates = []
|
||||
self.channelname = 'test-channel'
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class TestEnableUser(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
self.exports = kojihub.RootExports()
|
||||
self.get_user = mock.patch('kojihub.get_user').start()
|
||||
self.get_user = mock.patch('kojihub.kojihub.get_user').start()
|
||||
|
||||
def test_non_exist_user(self):
|
||||
username = 'test-user'
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ class TestEnsureVolumeSymlink(unittest.TestCase):
|
|||
self.tempdir = tempfile.mkdtemp()
|
||||
self.pathinfo = koji.PathInfo(self.tempdir)
|
||||
mock.patch('koji.pathinfo', new=self.pathinfo).start()
|
||||
mock.patch('kojihub.lookup_name', new=self.my_lookup_name).start()
|
||||
self.check_volume_policy = mock.patch('kojihub.check_volume_policy',
|
||||
mock.patch('kojihub.kojihub.lookup_name', new=self.my_lookup_name).start()
|
||||
self.check_volume_policy = mock.patch('kojihub.kojihub.check_volume_policy',
|
||||
return_value={'id':0, 'name': 'DEFAULT'}).start()
|
||||
self.buildinfo = {
|
||||
'id': 137,
|
||||
|
|
@ -48,7 +48,7 @@ class TestEnsureVolumeSymlink(unittest.TestCase):
|
|||
raise Exception('call created unexpected files')
|
||||
|
||||
del self.buildinfo['volume_name']
|
||||
with mock.patch('kojihub.logger') as logger:
|
||||
with mock.patch('kojihub.kojihub.logger') as logger:
|
||||
kojihub.ensure_volume_symlink(self.buildinfo)
|
||||
logger.warning.assert_called_once()
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class TestFindBuildId(unittest.TestCase):
|
|||
return query
|
||||
|
||||
def setUp(self):
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.query_singleValue = mock.MagicMock()
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ class TestGetRPM(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
self.exports = kojihub.RootExports()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.get_external_repo_id = mock.patch('kojihub.get_external_repo_id').start()
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.get_external_repo_id = mock.patch('kojihub.kojihub.get_external_repo_id').start()
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
|
||||
|
|
@ -99,10 +99,10 @@ class TestGetRPMHeaders(unittest.TestCase):
|
|||
def setUp(self):
|
||||
self.exports = kojihub.RootExports()
|
||||
self.exports.getLoggedInUser = mock.MagicMock()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.cursor = mock.MagicMock()
|
||||
self.get_rpm = mock.patch('kojihub.get_rpm').start()
|
||||
self.get_build = mock.patch('kojihub.get_build').start()
|
||||
self.get_rpm = mock.patch('kojihub.kojihub.get_rpm').start()
|
||||
self.get_build = mock.patch('kojihub.kojihub.get_build').start()
|
||||
self.get_header_fields = mock.patch('koji.get_header_fields').start()
|
||||
self.tempdir = tempfile.mkdtemp()
|
||||
self.pathinfo = koji.PathInfo(self.tempdir)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import kojihub
|
|||
|
||||
class TestGetRPMDeps(unittest.TestCase):
|
||||
|
||||
@mock.patch('kojihub.get_rpm')
|
||||
@mock.patch('kojihub.kojihub.get_rpm')
|
||||
def test_getRPMDeps_no_rpminfo(self, get_rpm):
|
||||
def mock_get_rpm(rpmID, strict=False):
|
||||
if strict:
|
||||
|
|
@ -21,7 +21,7 @@ class TestGetRPMDeps(unittest.TestCase):
|
|||
kojihub.RootExports().getRPMDeps(1, strict=True)
|
||||
self.assertEqual(cm.exception.args[0], 'msg')
|
||||
|
||||
@mock.patch('kojihub.get_rpm', return_value={'id': 1, 'build_id': None})
|
||||
@mock.patch('kojihub.kojihub.get_rpm', return_value={'id': 1, 'build_id': None})
|
||||
def test_getRPMDeps_external_rpm(self, get_rpm):
|
||||
re = kojihub.RootExports().getRPMDeps(1)
|
||||
self.assertEqual(re, [])
|
||||
|
|
@ -30,8 +30,8 @@ class TestGetRPMDeps(unittest.TestCase):
|
|||
self.assertEqual(cm.exception.args[0],
|
||||
'Can not get dependencies, because RPM: 1 is not internal')
|
||||
|
||||
@mock.patch('kojihub.get_rpm', return_value={'id': 1, 'build_id': 1})
|
||||
@mock.patch('kojihub.get_build', return_value={'id': 1})
|
||||
@mock.patch('kojihub.kojihub.get_rpm', return_value={'id': 1, 'build_id': 1})
|
||||
@mock.patch('kojihub.kojihub.get_build', return_value={'id': 1})
|
||||
@mock.patch('koji.pathinfo.build', return_value='fakebuildpath')
|
||||
@mock.patch('koji.pathinfo.rpm', return_value='fakerpmrelpath')
|
||||
@mock.patch('os.path.exists', return_value=False)
|
||||
|
|
@ -42,8 +42,8 @@ class TestGetRPMDeps(unittest.TestCase):
|
|||
kojihub.RootExports().getRPMDeps(1, strict=True)
|
||||
self.assertEqual(cm.exception.args[0], "RPM file of 1 doesn't exist")
|
||||
|
||||
@mock.patch('kojihub.get_rpm')
|
||||
@mock.patch('kojihub.get_build')
|
||||
@mock.patch('kojihub.kojihub.get_rpm')
|
||||
@mock.patch('kojihub.kojihub.get_build')
|
||||
@mock.patch('koji.pathinfo')
|
||||
def test_getRPMDeps(self, pi, build, rpm):
|
||||
pi.build.return_value = os.path.join(os.path.dirname(__file__), '../test_lib/data/rpms')
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import kojihub
|
|||
|
||||
class TestGetRPMFile(unittest.TestCase):
|
||||
|
||||
@mock.patch('kojihub.get_rpm')
|
||||
@mock.patch('kojihub.kojihub.get_rpm')
|
||||
def test_getRPMFile_no_rpminfo(self, get_rpm):
|
||||
def mock_get_rpm(rpmID, strict=False):
|
||||
if strict:
|
||||
|
|
@ -25,7 +25,7 @@ class TestGetRPMFile(unittest.TestCase):
|
|||
kojihub.RootExports().getRPMFile(1, 'filename', strict=True)
|
||||
self.assertEqual(cm.exception.args[0], 'msg')
|
||||
|
||||
@mock.patch('kojihub.get_rpm', return_value={'id': 1, 'build_id': None})
|
||||
@mock.patch('kojihub.kojihub.get_rpm', return_value={'id': 1, 'build_id': None})
|
||||
def test_getRPMFile_external_rpm(self, get_rpm):
|
||||
re = kojihub.RootExports().getRPMFile(1, 'filename')
|
||||
self.assertEqual(re, {})
|
||||
|
|
@ -34,8 +34,8 @@ class TestGetRPMFile(unittest.TestCase):
|
|||
self.assertEqual(cm.exception.args[0],
|
||||
'Can not get RPM file, because RPM: 1 is not internal')
|
||||
|
||||
@mock.patch('kojihub.get_rpm', return_value={'id': 1, 'build_id': 1})
|
||||
@mock.patch('kojihub.get_build', return_value={'id': 1})
|
||||
@mock.patch('kojihub.kojihub.get_rpm', return_value={'id': 1, 'build_id': 1})
|
||||
@mock.patch('kojihub.kojihub.get_build', return_value={'id': 1})
|
||||
@mock.patch('koji.pathinfo.build', return_value='fakebuildpath')
|
||||
@mock.patch('koji.pathinfo.rpm', return_value='fakerpmrelpath')
|
||||
@mock.patch('os.path.exists', return_value=False)
|
||||
|
|
@ -46,8 +46,8 @@ class TestGetRPMFile(unittest.TestCase):
|
|||
kojihub.RootExports().getRPMFile(1, 'filename', strict=True)
|
||||
self.assertEqual(cm.exception.args[0], "RPM package file of 1 doesn't exist")
|
||||
|
||||
@mock.patch('kojihub.get_rpm', return_value={'id': 1, 'build_id': 1})
|
||||
@mock.patch('kojihub.get_build')
|
||||
@mock.patch('kojihub.kojihub.get_rpm', return_value={'id': 1, 'build_id': 1})
|
||||
@mock.patch('kojihub.kojihub.get_build')
|
||||
@mock.patch('koji.pathinfo')
|
||||
def test_getRPMFile(self, pi, build, rpm):
|
||||
pi.build.return_value = os.path.join(os.path.dirname(__file__),
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ QP = kojihub.QueryProcessor
|
|||
class TestGetActiveRepos(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ class TestGetArchive(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
self.maxDiff = None
|
||||
self.list_archives = mock.patch('kojihub.list_archives').start()
|
||||
self.get_maven_archive = mock.patch('kojihub.get_maven_archive').start()
|
||||
self.get_win_archive = mock.patch('kojihub.get_win_archive').start()
|
||||
self.get_image_archive = mock.patch('kojihub.get_image_archive').start()
|
||||
self.list_archives = mock.patch('kojihub.kojihub.list_archives').start()
|
||||
self.get_maven_archive = mock.patch('kojihub.kojihub.get_maven_archive').start()
|
||||
self.get_win_archive = mock.patch('kojihub.kojihub.get_win_archive').start()
|
||||
self.get_image_archive = mock.patch('kojihub.kojihub.get_image_archive').start()
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ EMPTY_FILES = []
|
|||
|
||||
class TestGetArchiveFile(unittest.TestCase):
|
||||
|
||||
@mock.patch('kojihub.list_archive_files')
|
||||
@mock.patch('kojihub.kojihub.list_archive_files')
|
||||
def test_simple(self, list_archive_files):
|
||||
list_archive_files.return_value = FILES
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ class TestGetArchiveFile(unittest.TestCase):
|
|||
list_archive_files.assert_called_with(1, strict=True)
|
||||
self.assertEqual(rv, FILES[0])
|
||||
|
||||
@mock.patch('kojihub.list_archive_files')
|
||||
@mock.patch('kojihub.kojihub.list_archive_files')
|
||||
def test_empty_files(self, list_archive_files):
|
||||
list_archive_files.return_value = EMPTY_FILES
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ class TestGetArchiveFile(unittest.TestCase):
|
|||
list_archive_files.assert_called_with(1, strict=True)
|
||||
self.assertEqual(cm.exception.args[0], 'error message')
|
||||
|
||||
@mock.patch('kojihub.list_archive_files')
|
||||
@mock.patch('kojihub.kojihub.list_archive_files')
|
||||
def test_non_existing_file(self, list_archive_files):
|
||||
list_archive_files.return_value = FILES
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class TestGetBuild(DBQueryTestCase):
|
|||
|
||||
def setUp(self):
|
||||
super(TestGetBuild, self).setUp()
|
||||
self.find_build_id = mock.patch('kojihub.find_build_id').start()
|
||||
self.find_build_id = mock.patch('kojihub.kojihub.find_build_id').start()
|
||||
|
||||
def test_non_exist_build_string(self):
|
||||
build = 'build-1-23'
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ import kojihub
|
|||
|
||||
class TestGetBuildConfig(unittest.TestCase):
|
||||
|
||||
@mock.patch('kojihub.readFullInheritance')
|
||||
@mock.patch('kojihub.get_tag')
|
||||
@mock.patch('kojihub.kojihub.readFullInheritance')
|
||||
@mock.patch('kojihub.kojihub.get_tag')
|
||||
def test_simple_tag(self, get_tag, readFullInheritance):
|
||||
tag = 'tag_name'
|
||||
get_tag.return_value = {'id': 123, 'name': tag, 'extra': {}}
|
||||
|
|
@ -25,8 +25,8 @@ class TestGetBuildConfig(unittest.TestCase):
|
|||
'config_inheritance': {'extra': {}, 'arches': None},
|
||||
})
|
||||
|
||||
@mock.patch('kojihub.readFullInheritance')
|
||||
@mock.patch('kojihub.get_tag')
|
||||
@mock.patch('kojihub.kojihub.readFullInheritance')
|
||||
@mock.patch('kojihub.kojihub.get_tag')
|
||||
def test_basic_inherited(self, get_tag, readFullInheritance):
|
||||
tag = 'tag_name'
|
||||
get_tag.side_effect = [
|
||||
|
|
@ -80,8 +80,8 @@ class TestGetBuildConfig(unittest.TestCase):
|
|||
'name': 'tag_name'
|
||||
})
|
||||
|
||||
@mock.patch('kojihub.readFullInheritance')
|
||||
@mock.patch('kojihub.get_tag')
|
||||
@mock.patch('kojihub.kojihub.readFullInheritance')
|
||||
@mock.patch('kojihub.kojihub.get_tag')
|
||||
def test_inherited_noconfig(self, get_tag, readFullInheritance):
|
||||
tag = 'tag_name'
|
||||
get_tag.side_effect = [
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import kojihub
|
|||
class TestGetBuildLogs(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.get_build = mock.patch('kojihub.get_build').start()
|
||||
self.get_build = mock.patch('kojihub.kojihub.get_build').start()
|
||||
self.pathinfo = mock.patch('koji.pathinfo').start()
|
||||
self.tempdir = tempfile.mkdtemp()
|
||||
koji.pathinfo.build_logs.return_value = self.tempdir
|
||||
|
|
@ -36,10 +36,10 @@ class TestGetBuildLogs(unittest.TestCase):
|
|||
|
||||
def test_get_build_logs_basic(self):
|
||||
files = [
|
||||
'noarch/build.log',
|
||||
'x86_64/build.log',
|
||||
's390x/build.log',
|
||||
]
|
||||
'noarch/build.log',
|
||||
'x86_64/build.log',
|
||||
's390x/build.log',
|
||||
]
|
||||
files.sort()
|
||||
self.make_tree(files)
|
||||
data = kojihub.get_build_logs('fakebuild')
|
||||
|
|
@ -58,25 +58,25 @@ class TestGetBuildLogs(unittest.TestCase):
|
|||
fo.write('NOT A DIRECTORY\n')
|
||||
koji.pathinfo.build_logs.return_value = fn
|
||||
try:
|
||||
data = kojihub.get_build_logs('fakebuild')
|
||||
kojihub.get_build_logs('fakebuild')
|
||||
raise Exception('Expected exception not raised')
|
||||
except koji.GenericError as e:
|
||||
self.assertEqual(e.args[0][:15], 'Not a directory')
|
||||
|
||||
def test_get_build_logs_emptydirs(self):
|
||||
files = [
|
||||
'./build.log',
|
||||
'noarch/build.log',
|
||||
'noarch/root.log',
|
||||
'x86_64/build.log',
|
||||
's390x/build.log',
|
||||
'oddball/log/dir/fake.log',
|
||||
]
|
||||
'./build.log',
|
||||
'noarch/build.log',
|
||||
'noarch/root.log',
|
||||
'x86_64/build.log',
|
||||
's390x/build.log',
|
||||
'oddball/log/dir/fake.log',
|
||||
]
|
||||
empty_dirs = [
|
||||
'foo/bar/baz/',
|
||||
'a/b/c/',
|
||||
'empty/',
|
||||
]
|
||||
'foo/bar/baz/',
|
||||
'a/b/c/',
|
||||
'empty/',
|
||||
]
|
||||
files.sort()
|
||||
self.make_tree(files + empty_dirs)
|
||||
data = kojihub.get_build_logs('fakebuild')
|
||||
|
|
@ -84,20 +84,20 @@ class TestGetBuildLogs(unittest.TestCase):
|
|||
files2.sort()
|
||||
self.assertEqual(files, files2)
|
||||
|
||||
@mock.patch('kojihub.logger')
|
||||
@mock.patch('kojihub.kojihub.logger')
|
||||
def test_get_build_logs_symlinks(self, logger):
|
||||
# symlinks should be ignored with a warning
|
||||
files = [
|
||||
'noarch/build.log',
|
||||
'noarch/root.log',
|
||||
'noarch/mock.log',
|
||||
'noarch/checkout.log',
|
||||
'noarch/readme.txt',
|
||||
'oddball/log/dir/fake.log',
|
||||
]
|
||||
'noarch/build.log',
|
||||
'noarch/root.log',
|
||||
'noarch/mock.log',
|
||||
'noarch/checkout.log',
|
||||
'noarch/readme.txt',
|
||||
'oddball/log/dir/fake.log',
|
||||
]
|
||||
empty_dirs = [
|
||||
'just_links/',
|
||||
]
|
||||
'just_links/',
|
||||
]
|
||||
files.sort()
|
||||
self.make_tree(files + empty_dirs)
|
||||
os.symlink('SOME/PATH', '%s/%s' % (self.tempdir, 'symlink.log'))
|
||||
|
|
@ -109,18 +109,18 @@ class TestGetBuildLogs(unittest.TestCase):
|
|||
self.assertEqual(files, files2)
|
||||
self.assertEqual(logger.warning.call_count, 3)
|
||||
|
||||
@mock.patch('kojihub.logger')
|
||||
@mock.patch('kojihub.kojihub.logger')
|
||||
def test_get_build_logs_nonfile(self, logger):
|
||||
# symlinks should be ignored
|
||||
files = [
|
||||
'noarch/build.log',
|
||||
'noarch/root.log',
|
||||
'noarch/mock.log',
|
||||
'noarch/checkout.log',
|
||||
'noarch/readme.txt',
|
||||
'noarch/hello',
|
||||
'oddball/log/dir/fake.log',
|
||||
]
|
||||
'noarch/build.log',
|
||||
'noarch/root.log',
|
||||
'noarch/mock.log',
|
||||
'noarch/checkout.log',
|
||||
'noarch/readme.txt',
|
||||
'noarch/hello',
|
||||
'oddball/log/dir/fake.log',
|
||||
]
|
||||
files.sort()
|
||||
self.make_tree(files)
|
||||
os.mkfifo('%s/%s' % (self.tempdir, 'this_is_a_named_pipe'))
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import kojihub
|
|||
class TestGetBuildNotification(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor').start()
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor').start()
|
||||
self.query = self.QueryProcessor.return_value
|
||||
self.exports = kojihub.RootExports()
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import kojihub
|
|||
class TestGetBuildNotificationBlock(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor').start()
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor').start()
|
||||
self.query = self.QueryProcessor.return_value
|
||||
self.exports = kojihub.RootExports()
|
||||
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ import kojihub
|
|||
class TestGetBuildNotificationBlocks(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.exports = kojihub.RootExports()
|
||||
self.get_user = mock.patch('kojihub.get_user').start()
|
||||
self.get_user = mock.patch('kojihub.kojihub.get_user').start()
|
||||
self.get_build_notification_blocks = mock.patch(
|
||||
'kojihub.get_build_notification_blocks').start()
|
||||
'kojihub.kojihub.get_build_notification_blocks').start()
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ import kojihub
|
|||
class TestGetBuildNotifications(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.exports = kojihub.RootExports()
|
||||
self.get_user = mock.patch('kojihub.get_user').start()
|
||||
self.get_build_notifications = mock.patch('kojihub.get_build_notifications').start()
|
||||
self.get_user = mock.patch('kojihub.kojihub.get_user').start()
|
||||
self.get_build_notifications = mock.patch('kojihub.kojihub.get_build_notifications').start()
|
||||
|
||||
def test_loggedin_user(self):
|
||||
self.get_user.return_value = {'id': 1}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import kojihub
|
|||
class TestGetBuildTarget(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.get_build_targets = mock.patch('kojihub.get_build_targets').start()
|
||||
self.get_build_targets = mock.patch('kojihub.kojihub.get_build_targets').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
self.build_target = 'build-target'
|
||||
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@ class TestGetBuildTargets(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
self.maxDiff = None
|
||||
self.name_or_id_clause = mock.patch('kojihub.name_or_id_clause').start()
|
||||
self.get_tag_id = mock.patch('kojihub.get_tag_id').start()
|
||||
self.name_or_id_clause = mock.patch('kojihub.kojihub.name_or_id_clause').start()
|
||||
self.get_tag_id = mock.patch('kojihub.kojihub.get_tag_id').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.cursor = mock.MagicMock()
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.build_target = 'build-target'
|
||||
|
|
|
|||
|
|
@ -10,14 +10,14 @@ class TestGetBuildType(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
self.maxDiff = None
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.query_execute = mock.MagicMock()
|
||||
self.get_build = mock.patch('kojihub.get_build').start()
|
||||
self.get_maven_build = mock.patch('kojihub.get_maven_build').start()
|
||||
self.get_win_build = mock.patch('kojihub.get_win_build').start()
|
||||
self.get_image_build = mock.patch('kojihub.get_image_build').start()
|
||||
self.get_build = mock.patch('kojihub.kojihub.get_build').start()
|
||||
self.get_maven_build = mock.patch('kojihub.kojihub.get_maven_build').start()
|
||||
self.get_win_build = mock.patch('kojihub.kojihub.get_win_build').start()
|
||||
self.get_image_build = mock.patch('kojihub.kojihub.get_image_build').start()
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import kojihub
|
|||
|
||||
class TestGetBuildroot(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.query_buildroots = mock.patch('kojihub.query_buildroots').start()
|
||||
self.query_buildroots = mock.patch('kojihub.kojihub.query_buildroots').start()
|
||||
self.buildroot_id = 1
|
||||
|
||||
def test_empty_buildroots_without_strict(self):
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ class TestGetChangelogEntries(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
self.exports = kojihub.RootExports()
|
||||
self.get_build = mock.patch('kojihub.get_build').start()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.get_build = mock.patch('kojihub.kojihub.get_build').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.cursor = mock.MagicMock()
|
||||
self.os_path_exists = mock.patch('os.path.exists').start()
|
||||
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ class TestGetChannel(unittest.TestCase):
|
|||
return query
|
||||
|
||||
def setUp(self):
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
|
||||
def tearDown(self):
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import kojihub
|
|||
class TestGetExternalRepo(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.get_external_repos = mock.patch('kojihub.get_external_repos').start()
|
||||
self.get_external_repos = mock.patch('kojihub.kojihub.get_external_repos').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
|
||||
def test_non_exist_repo_with_strict(self):
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@ import kojihub
|
|||
class TestGetGroupMembers(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.get_user = mock.patch('kojihub.get_user').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.context.session.assertPerm = mock.MagicMock()
|
||||
self.get_user = mock.patch('kojihub.kojihub.get_user').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
|
||||
def test_non_exist_group(self):
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@ class TestSetHostEnabled(unittest.TestCase):
|
|||
return query
|
||||
|
||||
def setUp(self):
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
# It seems MagicMock will not automatically handle attributes that
|
||||
# start with "assert"
|
||||
self.exports = kojihub.RootExports()
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class TestGetLastHostUpdate(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
self.exports = kojihub.RootExports()
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.query_singleValue = mock.MagicMock()
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ from psycopg2._psycopg import IntegrityError
|
|||
class TestGetNextBuild(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.get_next_release = mock.patch('kojihub.get_next_release').start()
|
||||
self.new_build = mock.patch('kojihub.new_build').start()
|
||||
self._dml = mock.patch('kojihub._dml').start()
|
||||
self.get_next_release = mock.patch('kojihub.kojihub.get_next_release').start()
|
||||
self.new_build = mock.patch('kojihub.kojihub.new_build').start()
|
||||
self._dml = mock.patch('kojihub.kojihub._dml').start()
|
||||
self.binfo = {'name': 'name', 'version': 'version'}
|
||||
|
||||
def tearDown(self):
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ class TestGetNextRelease(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
self.maxDiff = None
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor').start()
|
||||
self.get_build = mock.patch('kojihub.get_build').start()
|
||||
self._dml = mock.patch('kojihub._dml').start()
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor').start()
|
||||
self.get_build = mock.patch('kojihub.kojihub.get_build').start()
|
||||
self._dml = mock.patch('kojihub.kojihub._dml').start()
|
||||
self.query = self.QueryProcessor.return_value
|
||||
self.binfo = {'name': 'name', 'version': 'version'}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,23 +29,23 @@ class TestGetNotificationRecipients(unittest.TestCase):
|
|||
return update
|
||||
|
||||
def setUp(self):
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.context.opts = {
|
||||
'EmailDomain': 'test.domain.com',
|
||||
'NotifyOnSuccess': True,
|
||||
}
|
||||
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.InsertProcessor = mock.patch('kojihub.InsertProcessor',
|
||||
self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',
|
||||
side_effect=self.getInsert).start()
|
||||
self.inserts = []
|
||||
self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',
|
||||
self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',
|
||||
side_effect=self.getUpdate).start()
|
||||
self.updates = []
|
||||
self.readPackageList = mock.patch('kojihub.readPackageList').start()
|
||||
self.get_user = mock.patch('kojihub.get_user').start()
|
||||
self.readPackageList = mock.patch('kojihub.kojihub.readPackageList').start()
|
||||
self.get_user = mock.patch('kojihub.kojihub.get_user').start()
|
||||
|
||||
self.exports = kojihub.RootExports()
|
||||
|
||||
|
|
|
|||
|
|
@ -15,14 +15,14 @@ class TestGetSessionInfo(unittest.TestCase):
|
|||
return query
|
||||
|
||||
def setUp(self):
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.context.session.hasPerm = mock.MagicMock()
|
||||
self.get_user = mock.patch('kojihub.get_user').start()
|
||||
self.get_user = mock.patch('kojihub.kojihub.get_user').start()
|
||||
self.userinfo = {'id': 123, 'name': 'testuser'}
|
||||
self.exports.getLoggedInUser = mock.MagicMock()
|
||||
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@ class TestGetTagExternalRepos(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
self.maxDiff = None
|
||||
self.get_tag = mock.patch('kojihub.get_tag').start()
|
||||
self.get_external_repo = mock.patch('kojihub.get_external_repo').start()
|
||||
self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()
|
||||
self.get_external_repo = mock.patch('kojihub.kojihub.get_external_repo').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.cursor = mock.MagicMock()
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.build_tag = 'tag'
|
||||
|
|
|
|||
|
|
@ -6,11 +6,12 @@ import kojihub
|
|||
|
||||
QP = kojihub.QueryProcessor
|
||||
|
||||
|
||||
class TestGetTaskChildren(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.exports = kojihub.RootExports()
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
|
||||
def getQuery(self, *args, **kwargs):
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ class TestGetUploadPath(unittest.TestCase):
|
|||
with self.assertRaises(GenericError):
|
||||
kojihub.get_upload_path(reldir='tasks/1/should_be_number', name='error', create=True)
|
||||
|
||||
@mock.patch('kojihub.context')
|
||||
@mock.patch('kojihub.Host')
|
||||
@mock.patch('kojihub.kojihub.context')
|
||||
@mock.patch('kojihub.kojihub.Host')
|
||||
def test_get_upload_path_invalid_upload_dir_owner(self, host, context):
|
||||
cursor = mock.MagicMock()
|
||||
context.cnx.cursor.return_value = cursor
|
||||
|
|
@ -49,7 +49,7 @@ class TestGetUploadPath(unittest.TestCase):
|
|||
with self.assertRaises(GenericError):
|
||||
kojihub.get_upload_path(reldir=reldir, name='error', create=True)
|
||||
|
||||
@mock.patch('kojihub.Host')
|
||||
@mock.patch('kojihub.kojihub.Host')
|
||||
def test_get_upload_path_invalid_upload_no_dir_owner(self, host):
|
||||
dir = kojihub.get_upload_path(reldir='tasks/1/1', name='error', create=False)
|
||||
assert dir == '%s/work/tasks/1/1/error' % self.topdir
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ class TestGetUser(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
self.exports = kojihub.RootExports()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ class TestGetUser(unittest.TestCase):
|
|||
|
||||
class TestGetUserByKrbPrincipal(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.get_user = mock.patch('kojihub.get_user').start()
|
||||
self.get_user = mock.patch('kojihub.kojihub.get_user').start()
|
||||
|
||||
def test_wrong_type_krb_principal(self):
|
||||
krb_principal = ['test-user']
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import kojihub
|
|||
|
||||
class TestGetUserPerms(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.get_user = mock.patch('kojihub.get_user').start()
|
||||
self.get_user = mock.patch('kojihub.kojihub.get_user').start()
|
||||
self.get_user_perms = mock.patch('koji.auth.get_user_perms').start()
|
||||
|
||||
def tearDown(self):
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class TestGetVolume(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
self.exports = kojihub.RootExports()
|
||||
self.lookup_name = mock.patch('kojihub.lookup_name').start()
|
||||
self.lookup_name = mock.patch('kojihub.kojihub.lookup_name').start()
|
||||
|
||||
def test_non_exist_volume_with_strict(self):
|
||||
volume = ['test-volume']
|
||||
|
|
|
|||
|
|
@ -13,14 +13,14 @@ UP = kojihub.UpdateProcessor
|
|||
class TestGrantPermission(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()
|
||||
self.get_user = mock.patch('kojihub.get_user').start()
|
||||
self.lookup_perm = mock.patch('kojihub.lookup_perm').start()
|
||||
self.insert_processor = mock.patch('kojihub.InsertProcessor').start()
|
||||
self.update_processor = mock.patch('kojihub.UpdateProcessor').start()
|
||||
self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()
|
||||
self.get_user = mock.patch('kojihub.kojihub.get_user').start()
|
||||
self.lookup_perm = mock.patch('kojihub.kojihub.lookup_perm').start()
|
||||
self.insert_processor = mock.patch('kojihub.kojihub.InsertProcessor').start()
|
||||
self.update_processor = mock.patch('kojihub.kojihub.UpdateProcessor').start()
|
||||
self.get_user_perms = mock.patch('koji.auth.get_user_perms').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
# It seems MagicMock will not automatically handle attributes that
|
||||
# start with "assert"
|
||||
self.context.session.assertPerm = mock.MagicMock()
|
||||
|
|
|
|||
|
|
@ -40,24 +40,24 @@ class TestGrouplist(unittest.TestCase):
|
|||
self.inserts = []
|
||||
|
||||
def setUp(self):
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.context_db = mock.patch('koji.db.context').start()
|
||||
self.get_tag = mock.patch('kojihub.get_tag').start()
|
||||
self.lookup_tag = mock.patch('kojihub.lookup_tag').start()
|
||||
self.lookup_group = mock.patch('kojihub.lookup_group').start()
|
||||
self.get_tag_groups = mock.patch('kojihub.get_tag_groups').start()
|
||||
self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()
|
||||
self.lookup_tag = mock.patch('kojihub.kojihub.lookup_tag').start()
|
||||
self.lookup_group = mock.patch('kojihub.kojihub.lookup_group').start()
|
||||
self.get_tag_groups = mock.patch('kojihub.kojihub.get_tag_groups').start()
|
||||
# It seems MagicMock will not automatically handle attributes that
|
||||
# start with "assert"
|
||||
self.context.session.assertPerm = mock.MagicMock()
|
||||
self.context_db.session.assertLogin = mock.MagicMock()
|
||||
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.InsertProcessor = mock.patch('kojihub.InsertProcessor',
|
||||
self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',
|
||||
side_effect=self.getInsert).start()
|
||||
self.inserts = []
|
||||
self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',
|
||||
self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',
|
||||
side_effect=self.getUpdate).start()
|
||||
self.updates = []
|
||||
self.tag = 'tag'
|
||||
|
|
@ -195,7 +195,7 @@ class TestGrouplist(unittest.TestCase):
|
|||
|
||||
# no group for tag found
|
||||
self.reset_db_processors()
|
||||
with mock.patch('kojihub.QueryProcessor', side_effect=self.getEmptyQuery):
|
||||
with mock.patch('kojihub.kojihub.QueryProcessor', side_effect=self.getEmptyQuery):
|
||||
with self.assertRaises(koji.GenericError) as cm:
|
||||
kojihub.grplist_remove(self.tag, self.group)
|
||||
|
||||
|
|
@ -207,7 +207,7 @@ class TestGrouplist(unittest.TestCase):
|
|||
|
||||
# force = True
|
||||
self.reset_db_processors()
|
||||
with mock.patch('kojihub.QueryProcessor',
|
||||
with mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getEmptyQuery):
|
||||
kojihub.grplist_remove(self.tag, self.group, force=True)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import kojihub
|
|||
class TestImportArchive(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
self.context.session.assertPerm = mock.MagicMock()
|
||||
self.filepath = 'path/to/file'
|
||||
|
|
|
|||
|
|
@ -20,19 +20,19 @@ class TestImportBuild(unittest.TestCase):
|
|||
with open(self.src_filename, 'w'):
|
||||
pass
|
||||
|
||||
self.check_volume_policy = mock.patch('kojihub.check_volume_policy').start()
|
||||
self.new_typed_build = mock.patch('kojihub.new_typed_build').start()
|
||||
self.check_volume_policy = mock.patch('kojihub.kojihub.check_volume_policy').start()
|
||||
self.new_typed_build = mock.patch('kojihub.kojihub.new_typed_build').start()
|
||||
self._dml = mock.patch('koji.db._dml').start()
|
||||
self.nextval = mock.patch('kojihub.nextval').start()
|
||||
self.get_build = mock.patch('kojihub.get_build').start()
|
||||
self.add_rpm_sig = mock.patch('kojihub.add_rpm_sig').start()
|
||||
self.nextval = mock.patch('kojihub.kojihub.nextval').start()
|
||||
self.get_build = mock.patch('kojihub.kojihub.get_build').start()
|
||||
self.add_rpm_sig = mock.patch('kojihub.kojihub.add_rpm_sig').start()
|
||||
self.rip_rpm_sighdr = mock.patch('koji.rip_rpm_sighdr').start()
|
||||
self.import_rpm_file = mock.patch('kojihub.import_rpm_file').start()
|
||||
self.import_rpm = mock.patch('kojihub.import_rpm').start()
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor').start()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.import_rpm_file = mock.patch('kojihub.kojihub.import_rpm_file').start()
|
||||
self.import_rpm = mock.patch('kojihub.kojihub.import_rpm').start()
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.context_db = mock.patch('koji.db.context').start()
|
||||
self.new_package = mock.patch('kojihub.new_package').start()
|
||||
self.new_package = mock.patch('kojihub.kojihub.new_package').start()
|
||||
self.get_rpm_header = mock.patch('koji.get_rpm_header').start()
|
||||
self.pathinfo_work = mock.patch('koji.pathinfo.work').start()
|
||||
self.os_path_exists = mock.patch('os.path.exists').start()
|
||||
|
|
|
|||
|
|
@ -10,14 +10,15 @@ import kojihub
|
|||
class TestImportImageInternal(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.tempdir = tempfile.mkdtemp()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.context_db = mock.patch('koji.db.context').start()
|
||||
self.Task = mock.patch('kojihub.Task').start()
|
||||
self.get_build = mock.patch('kojihub.get_build').start()
|
||||
self.get_archive_type = mock.patch('kojihub.get_archive_type').start()
|
||||
self.Task = mock.patch('kojihub.kojihub.Task').start()
|
||||
self.get_build = mock.patch('kojihub.kojihub.get_build').start()
|
||||
self.get_archive_type = mock.patch('kojihub.kojihub.get_archive_type').start()
|
||||
self.path_work = mock.patch('koji.pathinfo.work').start()
|
||||
self.import_archive = mock.patch('kojihub.import_archive').start()
|
||||
self.import_archive = mock.patch('kojihub.kojihub.import_archive').start()
|
||||
self.build = mock.patch('koji.pathinfo.build').start()
|
||||
self.get_rpm = mock.patch('kojihub.get_rpm').start()
|
||||
self.get_rpm = mock.patch('kojihub.kojihub.get_rpm').start()
|
||||
|
||||
def tearDown(self):
|
||||
shutil.rmtree(self.tempdir)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class TestImportRPM(unittest.TestCase):
|
|||
# Touch a file
|
||||
with open(self.src_filename, 'w'):
|
||||
pass
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.context.session.assertPerm = mock.MagicMock()
|
||||
self.context_db = mock.patch('koji.db.context').start()
|
||||
self.cursor = mock.MagicMock()
|
||||
|
|
@ -46,13 +46,13 @@ class TestImportRPM(unittest.TestCase):
|
|||
1106: 'sourcepackage',
|
||||
261: 'payload hash',
|
||||
}
|
||||
self.get_build = mock.patch('kojihub.get_build').start()
|
||||
self.get_build = mock.patch('kojihub.kojihub.get_build').start()
|
||||
self.get_rpm_header = mock.patch('koji.get_rpm_header').start()
|
||||
self.new_typed_build = mock.patch('kojihub.new_typed_build').start()
|
||||
self.nextval = mock.patch('kojihub.nextval').start()
|
||||
self.new_typed_build = mock.patch('kojihub.kojihub.new_typed_build').start()
|
||||
self.nextval = mock.patch('kojihub.kojihub.nextval').start()
|
||||
self.os_path_exists = mock.patch('os.path.exists').start()
|
||||
self.os_path_basename = mock.patch('os.path.basename').start()
|
||||
self.InsertProcessor = mock.patch('kojihub.InsertProcessor',
|
||||
self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',
|
||||
side_effect=self.getInsert).start()
|
||||
self.inserts = []
|
||||
|
||||
|
|
@ -167,7 +167,7 @@ class TestImportRPM(unittest.TestCase):
|
|||
self.get_rpm_header.return_value = retval
|
||||
self.os_path_exists.return_value = True
|
||||
self.os_path_basename.return_value = 'name-version-release.arch.rpm'
|
||||
kojihub.get_build.return_value = None
|
||||
self.get_build.return_value = None
|
||||
with self.assertRaises(koji.GenericError) as cm:
|
||||
kojihub.import_rpm(self.src_filename)
|
||||
self.assertEqual("No such build", str(cm.exception))
|
||||
|
|
|
|||
|
|
@ -16,17 +16,17 @@ class TestListArchiveFiles(unittest.TestCase):
|
|||
self.mm = mock.MagicMock()
|
||||
# Note: the following mocks copy() the return value dict because some
|
||||
# of the tests modify it
|
||||
self.mm.get_build = mock.patch('kojihub.get_build',
|
||||
self.mm.get_build = mock.patch('kojihub.kojihub.get_build',
|
||||
return_value=GET_BUILD_RV.copy()).start()
|
||||
self.mm.get_archive_type = mock.patch('kojihub.get_archive_type',
|
||||
self.mm.get_archive_type = mock.patch('kojihub.kojihub.get_archive_type',
|
||||
return_value=GET_ARCHIVE_TYPE_RV.copy()).start()
|
||||
self.mm.get_archive = mock.patch('kojihub.get_archive',
|
||||
self.mm.get_archive = mock.patch('kojihub.kojihub.get_archive',
|
||||
return_value=GET_ARCHIVE_RV.copy()).start()
|
||||
self.mm.get_maven_archive = mock.patch('kojihub.get_maven_archive').start()
|
||||
self.mm.get_win_archive = mock.patch('kojihub.get_win_archive').start()
|
||||
self.mm.get_image_archive = mock.patch('kojihub.get_image_archive').start()
|
||||
self.mm.get_zipfile_list = mock.patch('kojihub._get_zipfile_list').start()
|
||||
self.mm.get_tarball_list = mock.patch('kojihub._get_tarball_list').start()
|
||||
self.mm.get_maven_archive = mock.patch('kojihub.kojihub.get_maven_archive').start()
|
||||
self.mm.get_win_archive = mock.patch('kojihub.kojihub.get_win_archive').start()
|
||||
self.mm.get_image_archive = mock.patch('kojihub.kojihub.get_image_archive').start()
|
||||
self.mm.get_zipfile_list = mock.patch('kojihub.kojihub._get_zipfile_list').start()
|
||||
self.mm.get_tarball_list = mock.patch('kojihub.kojihub._get_tarball_list').start()
|
||||
self.maven_archive = {'archive_id': 1, 'group_id': 'gid', 'artifact_id': 'aid',
|
||||
'version': '1.0.0'}
|
||||
self.win_archive = {'archive_id': 1, 'relpath': 'rpath', 'platform': 'all',
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ QP = kojihub.QueryProcessor
|
|||
class TestListArchives(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.maxDiff = None
|
||||
self.get_build = mock.patch('kojihub.get_build').start()
|
||||
self.get_host = mock.patch('kojihub.get_host').start()
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.get_build = mock.patch('kojihub.kojihub.get_build').start()
|
||||
self.get_host = mock.patch('kojihub.kojihub.get_host').start()
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.get_query).start()
|
||||
self.queries = []
|
||||
self.exports = kojihub.RootExports()
|
||||
|
|
@ -36,7 +36,7 @@ class TestListArchives(unittest.TestCase):
|
|||
self.assertEqual(query.joins, ['archivetypes on archiveinfo.type_id = archivetypes.id',
|
||||
'btype ON archiveinfo.btype_id = btype.id'])
|
||||
|
||||
@mock.patch('kojihub.QueryProcessor')
|
||||
@mock.patch('kojihub.kojihub.QueryProcessor')
|
||||
def test_list_archives_strict(self, QueryProcessor):
|
||||
query = QueryProcessor.return_value
|
||||
query.execute.return_value = None
|
||||
|
|
@ -208,7 +208,7 @@ class TestListArchives(unittest.TestCase):
|
|||
'image_archives ON archiveinfo.id = image_archives.archive_id'])
|
||||
self.assertEqual(query.values, {'arch': 'i386'})
|
||||
|
||||
@mock.patch('kojihub.lookup_name', return_value={'id': 111, 'name': 'other'})
|
||||
@mock.patch('kojihub.kojihub.lookup_name', return_value={'id': 111, 'name': 'other'})
|
||||
def test_list_archives_type_others(self, lookup_name):
|
||||
kojihub.list_archives(type='other')
|
||||
self.assertEqual(len(self.queries), 1)
|
||||
|
|
@ -220,13 +220,13 @@ class TestListArchives(unittest.TestCase):
|
|||
'btype ON archiveinfo.btype_id = btype.id'])
|
||||
self.assertEqual(query.values, {'btype_id': 111})
|
||||
|
||||
@mock.patch('kojihub.lookup_name', return_value=None)
|
||||
@mock.patch('kojihub.kojihub.lookup_name', return_value=None)
|
||||
def test_list_archives_type_not_found(self, lookup_name):
|
||||
with self.assertRaises(koji.GenericError) as cm:
|
||||
kojihub.list_archives(type='other')
|
||||
self.assertEqual(cm.exception.args[0], 'unsupported archive type: other')
|
||||
|
||||
@mock.patch('kojihub.lookup_name', return_value={'id': 111, 'name': 'other'})
|
||||
@mock.patch('kojihub.kojihub.lookup_name', return_value={'id': 111, 'name': 'other'})
|
||||
def test_list_archives_type_other_with_typeinfo(self, lookup_name):
|
||||
with self.assertRaises(koji.GenericError) as cm:
|
||||
kojihub.list_archives(type='other', typeInfo={'somekey': 'somevalue'})
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ QP = kojihub.QueryProcessor
|
|||
class TestListBTypes(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.get_query).start()
|
||||
self.queries = []
|
||||
self.exports = kojihub.RootExports()
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@ class TestListBuilds(unittest.TestCase):
|
|||
self.maxDiff = None
|
||||
self.exports = kojihub.RootExports()
|
||||
self.query_executeOne = mock.MagicMock()
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.get_package_id = mock.patch('kojihub.get_package_id').start()
|
||||
self.get_user = mock.patch('kojihub.get_user').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.get_package_id = mock.patch('kojihub.kojihub.get_package_id').start()
|
||||
self.get_user = mock.patch('kojihub.kojihub.get_user').start()
|
||||
self.cursor = mock.MagicMock()
|
||||
self.build_list = [{'build_id': 9,
|
||||
'epoch': 0,
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@ class TestListChannels(unittest.TestCase):
|
|||
return query
|
||||
|
||||
def setUp(self):
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
# It seems MagicMock will not automatically handle attributes that
|
||||
# start with "assert"
|
||||
self.exports = kojihub.RootExports()
|
||||
self.get_host = mock.patch('kojihub.get_host').start()
|
||||
self.get_host = mock.patch('kojihub.kojihub.get_host').start()
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ QP = kojihub.QueryProcessor
|
|||
class TestListHosts(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
side_effect=self.get_query).start()
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.get_query).start()
|
||||
self.queries = []
|
||||
self.exports = kojihub.RootExports()
|
||||
|
||||
|
|
@ -31,9 +31,9 @@ class TestListHosts(unittest.TestCase):
|
|||
query = self.queries[0]
|
||||
self.assertEqual(query.tables, ['host_config'])
|
||||
self.assertEqual(query.joins, ['host ON host.id = host_config.host_id'])
|
||||
self.assertEqual(query.clauses, ['host_config.active IS TRUE',])
|
||||
self.assertEqual(query.clauses, ['host_config.active IS TRUE'])
|
||||
|
||||
@mock.patch('kojihub.get_user')
|
||||
@mock.patch('kojihub.kojihub.get_user')
|
||||
def test_list_hosts_user_id(self, get_user):
|
||||
get_user.return_value = {'id': 99}
|
||||
self.exports.listHosts(userID=99)
|
||||
|
|
@ -44,7 +44,7 @@ class TestListHosts(unittest.TestCase):
|
|||
self.assertEqual(query.joins, ['host ON host.id = host_config.host_id'])
|
||||
self.assertEqual(query.clauses, ['host_config.active IS TRUE', 'user_id = %(userID)i'])
|
||||
|
||||
@mock.patch('kojihub.get_channel_id')
|
||||
@mock.patch('kojihub.kojihub.get_channel_id')
|
||||
def test_list_hosts_channel_id(self, get_channel_id):
|
||||
get_channel_id.return_value = 2
|
||||
self.exports.listHosts(channelID=2)
|
||||
|
|
@ -58,7 +58,7 @@ class TestListHosts(unittest.TestCase):
|
|||
'host_channels.active IS TRUE',
|
||||
'host_channels.channel_id = %(channelID)i',
|
||||
'host_config.active IS TRUE',
|
||||
])
|
||||
])
|
||||
|
||||
def test_list_hosts_single_arch(self):
|
||||
self.exports.listHosts(arches='x86_64')
|
||||
|
|
@ -68,7 +68,7 @@ class TestListHosts(unittest.TestCase):
|
|||
self.assertEqual(query.tables, ['host_config'])
|
||||
self.assertEqual(query.joins, ['host ON host.id = host_config.host_id'])
|
||||
self.assertEqual(query.clauses, ['arches ~ %(archPattern)s',
|
||||
'host_config.active IS TRUE'])
|
||||
'host_config.active IS TRUE'])
|
||||
|
||||
def test_list_hosts_multi_arch(self):
|
||||
self.exports.listHosts(arches=['x86_64', 's390'])
|
||||
|
|
@ -92,7 +92,7 @@ class TestListHosts(unittest.TestCase):
|
|||
query = self.queries[0]
|
||||
self.assertEqual(query.tables, ['host_config'])
|
||||
self.assertEqual(query.joins, ['host ON host.id = host_config.host_id'])
|
||||
self.assertEqual(query.clauses, ['host_config.active IS TRUE','ready IS TRUE'])
|
||||
self.assertEqual(query.clauses, ['host_config.active IS TRUE', 'ready IS TRUE'])
|
||||
|
||||
def test_list_hosts_nonready(self):
|
||||
self.exports.listHosts(ready=0)
|
||||
|
|
@ -101,7 +101,7 @@ class TestListHosts(unittest.TestCase):
|
|||
query = self.queries[0]
|
||||
self.assertEqual(query.tables, ['host_config'])
|
||||
self.assertEqual(query.joins, ['host ON host.id = host_config.host_id'])
|
||||
self.assertEqual(query.clauses, ['host_config.active IS TRUE','ready IS FALSE'])
|
||||
self.assertEqual(query.clauses, ['host_config.active IS TRUE', 'ready IS FALSE'])
|
||||
|
||||
def test_list_hosts_enabled(self):
|
||||
self.exports.listHosts(enabled=1)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class TestListPackagesSimple(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
self.maxDiff = None
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.get_query).start()
|
||||
self.queries = []
|
||||
self.exports = kojihub.RootExports()
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ QP = kojihub.QueryProcessor
|
|||
|
||||
class TestListRpms(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.get_query).start()
|
||||
self.queries = []
|
||||
self.get_build = mock.patch('kojihub.get_build').start()
|
||||
self.get_host = mock.patch('kojihub.get_host').start()
|
||||
self._dml = mock.patch('kojihub._dml').start()
|
||||
self.get_build = mock.patch('kojihub.kojihub.get_build').start()
|
||||
self.get_host = mock.patch('kojihub.kojihub.get_host').start()
|
||||
self._dml = mock.patch('kojihub.kojihub._dml').start()
|
||||
self.list_rpms = {'arch': 'x86_64',
|
||||
'build_id': 1,
|
||||
'buildroot_id': 2,
|
||||
|
|
|
|||
|
|
@ -10,14 +10,14 @@ QP = kojihub.QueryProcessor
|
|||
|
||||
class TestListTagged(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.get_tag = mock.patch('kojihub.get_tag').start()
|
||||
self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.cursor = mock.MagicMock()
|
||||
self.readTaggedBuilds = mock.patch('kojihub.readTaggedBuilds').start()
|
||||
self.readTaggedBuilds = mock.patch('kojihub.kojihub.readTaggedBuilds').start()
|
||||
self.tag_name = 'test-tag'
|
||||
self.taginfo = {'id': 1, 'name': 'tag'}
|
||||
self.tagged_build = [
|
||||
|
|
|
|||
|
|
@ -10,14 +10,14 @@ QP = kojihub.QueryProcessor
|
|||
|
||||
class TestListTaggedArchives(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.get_tag = mock.patch('kojihub.get_tag').start()
|
||||
self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.cursor = mock.MagicMock()
|
||||
self.readTaggedArchives = mock.patch('kojihub.readTaggedArchives').start()
|
||||
self.readTaggedArchives = mock.patch('kojihub.kojihub.readTaggedArchives').start()
|
||||
self.tag_name = 'test-tag'
|
||||
self.taginfo = {'id': 1, 'name': 'tag'}
|
||||
self.tagged_archives = [
|
||||
|
|
|
|||
|
|
@ -10,14 +10,14 @@ QP = kojihub.QueryProcessor
|
|||
|
||||
class TestListTaggedRPMS(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.get_tag = mock.patch('kojihub.get_tag').start()
|
||||
self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.cursor = mock.MagicMock()
|
||||
self.readTaggedRPMS = mock.patch('kojihub.readTaggedRPMS').start()
|
||||
self.readTaggedRPMS = mock.patch('kojihub.kojihub.readTaggedRPMS').start()
|
||||
self.tag_name = 'test-tag'
|
||||
self.taginfo = {'id': 1, 'name': 'tag'}
|
||||
self.tagged_rpms = [
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ class TestListTags(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
self.maxDiff = None
|
||||
self.get_build = mock.patch('kojihub.get_build').start()
|
||||
self.get_build = mock.patch('kojihub.kojihub.get_build').start()
|
||||
self.exports = kojihub.RootExports()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.cursor = mock.MagicMock()
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ class TestListTags(unittest.TestCase):
|
|||
self.exports.listTags(build=build_name)
|
||||
self.assertEqual(f"No such build: {build_name}", str(cm.exception))
|
||||
|
||||
@mock.patch('kojihub.lookup_package')
|
||||
@mock.patch('kojihub.kojihub.lookup_package')
|
||||
def test_non_exist_package(self, lookup_package):
|
||||
self.cursor.fetchone.return_value = None
|
||||
self.context.cnx.cursor.return_value = self.cursor
|
||||
|
|
@ -68,7 +68,7 @@ class TestListTags(unittest.TestCase):
|
|||
self.assertEqual("only one of build and package may be specified", str(cm.exception))
|
||||
self.get_build.assert_not_called()
|
||||
|
||||
@mock.patch('kojihub.lookup_package')
|
||||
@mock.patch('kojihub.kojihub.lookup_package')
|
||||
def test_exist_package_and_perms(self, lookup_package):
|
||||
package_info = {'id': 123, 'name': 'package-name'}
|
||||
self.cursor.fetchone.return_value = None
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class TestListTaskOutput(unittest.TestCase):
|
|||
}
|
||||
})
|
||||
|
||||
@mock.patch('kojihub.list_volumes')
|
||||
@mock.patch('kojihub.kojihub.list_volumes')
|
||||
@mock.patch('os.stat')
|
||||
@mock.patch('os.path.isdir')
|
||||
@mock.patch('os.walk')
|
||||
|
|
@ -60,7 +60,7 @@ class TestListTaskOutput(unittest.TestCase):
|
|||
result = kojihub.list_task_output(1, all_volumes=True)
|
||||
self.assertEqual(result, {'file': ['DEFAULT']})
|
||||
|
||||
@mock.patch('kojihub.list_volumes')
|
||||
@mock.patch('kojihub.kojihub.list_volumes')
|
||||
@mock.patch('os.stat')
|
||||
@mock.patch('os.path.isdir')
|
||||
@mock.patch('os.walk')
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@ class TestListing(unittest.TestCase):
|
|||
aliases=mock.ANY,
|
||||
)
|
||||
|
||||
@mock.patch('kojihub.QueryProcessor')
|
||||
@mock.patch('kojihub.kojihub.QueryProcessor')
|
||||
def test_list_tasks_basic_invocation(self, processor):
|
||||
generator = self.hub.listTasks()
|
||||
list(generator) # Exhaust the generator
|
||||
processor.assert_called_once_with(**self.standard_processor_kwargs)
|
||||
|
||||
@mock.patch('kojihub.QueryProcessor')
|
||||
@mock.patch('kojihub.kojihub.QueryProcessor')
|
||||
def test_list_tasks_by_owner_as_int(self, processor):
|
||||
generator = self.hub.listTasks(opts={'owner': 1})
|
||||
results = list(generator) # Exhaust the generator
|
||||
|
|
@ -32,7 +32,7 @@ class TestListing(unittest.TestCase):
|
|||
processor.assert_called_once_with(**arguments)
|
||||
self.assertEqual(results, [])
|
||||
|
||||
@mock.patch('kojihub.QueryProcessor')
|
||||
@mock.patch('kojihub.kojihub.QueryProcessor')
|
||||
def test_list_tasks_by_not_owner_as_int(self, processor):
|
||||
generator = self.hub.listTasks(opts={'not_owner': 1})
|
||||
results = list(generator) # Exhaust the generator
|
||||
|
|
@ -41,7 +41,7 @@ class TestListing(unittest.TestCase):
|
|||
processor.assert_called_once_with(**arguments)
|
||||
self.assertEqual(results, [])
|
||||
|
||||
@mock.patch('kojihub.QueryProcessor')
|
||||
@mock.patch('kojihub.kojihub.QueryProcessor')
|
||||
def test_list_tasks_by_arch(self, processor):
|
||||
generator = self.hub.listTasks(opts={'arch': ['x86_64']})
|
||||
results = list(generator) # Exhaust the generator
|
||||
|
|
@ -50,7 +50,7 @@ class TestListing(unittest.TestCase):
|
|||
processor.assert_called_once_with(**arguments)
|
||||
self.assertEqual(results, [])
|
||||
|
||||
@mock.patch('kojihub.QueryProcessor')
|
||||
@mock.patch('kojihub.kojihub.QueryProcessor')
|
||||
def test_list_tasks_by_not_arch(self, processor):
|
||||
generator = self.hub.listTasks(opts={'not_arch': ['x86_64']})
|
||||
results = list(generator) # Exhaust the generator
|
||||
|
|
@ -59,7 +59,7 @@ class TestListing(unittest.TestCase):
|
|||
processor.assert_called_once_with(**arguments)
|
||||
self.assertEqual(results, [])
|
||||
|
||||
@mock.patch('kojihub.QueryProcessor')
|
||||
@mock.patch('kojihub.kojihub.QueryProcessor')
|
||||
def test_list_tasks_by_owner_as_list(self, processor):
|
||||
generator = self.hub.listTasks(opts={'owner': [1, 2]})
|
||||
results = list(generator) # Exhaust the generator
|
||||
|
|
@ -68,7 +68,7 @@ class TestListing(unittest.TestCase):
|
|||
processor.assert_called_once_with(**arguments)
|
||||
self.assertEqual(results, [])
|
||||
|
||||
@mock.patch('kojihub.QueryProcessor')
|
||||
@mock.patch('kojihub.kojihub.QueryProcessor')
|
||||
def test_list_tasks_by_not_owner_as_list(self, processor):
|
||||
generator = self.hub.listTasks(opts={'not_owner': [1, 2]})
|
||||
results = list(generator) # Exhaust the generator
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ class TestListUserKrbPrincipals(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
self.exports = kojihub.RootExports()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
|
||||
|
|
|
|||
|
|
@ -13,15 +13,15 @@ IP = kojihub.InsertProcessor
|
|||
class TestLookupName(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.query_executeOne = mock.MagicMock()
|
||||
self.InsertProcessor = mock.patch('kojihub.InsertProcessor',
|
||||
self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',
|
||||
side_effect=self.getInsert).start()
|
||||
self.inserts = []
|
||||
self.nextval = mock.patch('kojihub.nextval').start()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
self.nextval = mock.patch('kojihub.kojihub.nextval').start()
|
||||
self.context = mock.patch('kojihub.kojihub.context').start()
|
||||
|
||||
def getQuery(self, *args, **kwargs):
|
||||
query = QP(*args, **kwargs)
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue