Pytest instead of nose in unittest
Fixes: https://pagure.io/koji/issue/3140
This commit is contained in:
parent
bbaadef417
commit
c310d6692d
34 changed files with 644 additions and 631 deletions
|
|
@ -30,11 +30,11 @@ class TestAddArchiveType(unittest.TestCase):
|
|||
|
||||
args, kwargs = InsertProcessor.call_args
|
||||
ip = IP(*args, **kwargs)
|
||||
self.assertEquals(ip.table, 'archivetypes')
|
||||
self.assertEquals(ip.data, {'name': 'deb',
|
||||
'description': 'Debian package',
|
||||
'extensions': 'deb'})
|
||||
self.assertEquals(ip.rawdata, {})
|
||||
self.assertEqual(ip.table, 'archivetypes')
|
||||
self.assertEqual(ip.data, {'name': 'deb',
|
||||
'description': 'Debian package',
|
||||
'extensions': 'deb'})
|
||||
self.assertEqual(ip.rawdata, {})
|
||||
session.assertPerm.assert_called_with('admin')
|
||||
|
||||
for m in mocks:
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ class TestAddBType(unittest.TestCase):
|
|||
|
||||
args, kwargs = InsertProcessor.call_args
|
||||
ip = IP(*args, **kwargs)
|
||||
self.assertEquals(ip.table, 'btype')
|
||||
self.assertEquals(ip.data, {'name': 'new_btype'})
|
||||
self.assertEquals(ip.rawdata, {})
|
||||
self.assertEqual(ip.table, 'btype')
|
||||
self.assertEqual(ip.data, {'name': 'new_btype'})
|
||||
self.assertEqual(ip.rawdata, {})
|
||||
session.assertPerm.assert_called_with('admin')
|
||||
|
||||
for m in mocks:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import copy
|
||||
import unittest
|
||||
from nose.tools import eq_
|
||||
|
||||
import kojihub
|
||||
|
||||
|
|
@ -12,11 +11,12 @@ class TestApplyQueryOpts(unittest.TestCase):
|
|||
{'foo': 2, 'bar': -1},
|
||||
{'foo': 0, 'bar': 0},
|
||||
]
|
||||
|
||||
def test_basic(self):
|
||||
opts = None
|
||||
expected = copy.copy(self.original)
|
||||
actual = kojihub._applyQueryOpts(self.original, opts)
|
||||
eq_(expected, actual)
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
def test_order_by_foo(self):
|
||||
opts = {'order': 'foo'}
|
||||
|
|
@ -26,7 +26,7 @@ class TestApplyQueryOpts(unittest.TestCase):
|
|||
{'foo': 2, 'bar': -1},
|
||||
]
|
||||
actual = kojihub._applyQueryOpts(self.original, opts)
|
||||
eq_(expected, actual)
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
def test_order_by_bar(self):
|
||||
opts = {'order': 'bar'}
|
||||
|
|
@ -36,7 +36,7 @@ class TestApplyQueryOpts(unittest.TestCase):
|
|||
{'foo': 1, 'bar': 1},
|
||||
]
|
||||
actual = kojihub._applyQueryOpts(self.original, opts)
|
||||
eq_(expected, actual)
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
def test_order_in_reverse(self):
|
||||
opts = {'order': '-foo'}
|
||||
|
|
@ -46,7 +46,7 @@ class TestApplyQueryOpts(unittest.TestCase):
|
|||
{'foo': 0, 'bar': 0},
|
||||
]
|
||||
actual = kojihub._applyQueryOpts(self.original, opts)
|
||||
eq_(expected, actual)
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
def test_offset(self):
|
||||
opts = {'offset': 1}
|
||||
|
|
@ -55,7 +55,7 @@ class TestApplyQueryOpts(unittest.TestCase):
|
|||
{'foo': 0, 'bar': 0},
|
||||
]
|
||||
actual = kojihub._applyQueryOpts(self.original, opts)
|
||||
eq_(expected, actual)
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
def test_limit(self):
|
||||
opts = {'limit': 2}
|
||||
|
|
@ -64,7 +64,7 @@ class TestApplyQueryOpts(unittest.TestCase):
|
|||
{'foo': 2, 'bar': -1},
|
||||
]
|
||||
actual = kojihub._applyQueryOpts(self.original, opts)
|
||||
eq_(expected, actual)
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
def test_limit_and_offset(self):
|
||||
opts = {'limit': 1, 'offset': 1}
|
||||
|
|
@ -72,15 +72,15 @@ class TestApplyQueryOpts(unittest.TestCase):
|
|||
{'foo': 2, 'bar': -1},
|
||||
]
|
||||
actual = kojihub._applyQueryOpts(self.original, opts)
|
||||
eq_(expected, actual)
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
def test_count_only(self):
|
||||
opts = {'countOnly': True}
|
||||
expected = 3
|
||||
actual = kojihub._applyQueryOpts(self.original, opts)
|
||||
eq_(expected, actual)
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
opts = {'countOnly': True, 'offset': 2}
|
||||
expected = 1
|
||||
actual = kojihub._applyQueryOpts(self.original, opts)
|
||||
eq_(expected, actual)
|
||||
self.assertEqual(expected, actual)
|
||||
|
|
|
|||
|
|
@ -6,30 +6,27 @@ import tempfile
|
|||
|
||||
import koji
|
||||
import kojihub
|
||||
from koji.util import dslice_ex
|
||||
|
||||
IP = kojihub.InsertProcessor
|
||||
|
||||
|
||||
class TestDistRepoInit(unittest.TestCase):
|
||||
|
||||
|
||||
def getInsert(self, *args, **kwargs):
|
||||
insert = IP(*args, **kwargs)
|
||||
insert.execute = mock.MagicMock()
|
||||
self.inserts.append(insert)
|
||||
return insert
|
||||
|
||||
|
||||
def setUp(self):
|
||||
self.tempdir = tempfile.mkdtemp()
|
||||
self.pathinfo = koji.PathInfo(self.tempdir)
|
||||
mock.patch('koji.pathinfo', new=self.pathinfo).start()
|
||||
|
||||
self.InsertProcessor = mock.patch('kojihub.InsertProcessor',
|
||||
side_effect=self.getInsert).start()
|
||||
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()
|
||||
|
|
@ -39,11 +36,9 @@ class TestDistRepoInit(unittest.TestCase):
|
|||
self.get_event.return_value = 12345
|
||||
self.nextval.return_value = 99
|
||||
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
|
||||
def test_simple_dist_repo_init(self):
|
||||
|
||||
# simple case
|
||||
|
|
@ -51,29 +46,27 @@ class TestDistRepoInit(unittest.TestCase):
|
|||
self.InsertProcessor.assert_called_once()
|
||||
|
||||
ip = self.inserts[0]
|
||||
self.assertEquals(ip.table, 'repo')
|
||||
self.assertEqual(ip.table, 'repo')
|
||||
data = {'dist': True, 'create_event': 12345, 'tag_id': 42, 'id': 99,
|
||||
'state': koji.REPO_STATES['INIT']}
|
||||
self.assertEquals(ip.data, data)
|
||||
self.assertEquals(ip.rawdata, {})
|
||||
'state': koji.REPO_STATES['INIT']}
|
||||
self.assertEqual(ip.data, data)
|
||||
self.assertEqual(ip.rawdata, {})
|
||||
|
||||
# no comps option
|
||||
self.copyfile.assert_not_called()
|
||||
|
||||
|
||||
def test_dist_repo_init_with_comps(self):
|
||||
|
||||
# simple case
|
||||
kojihub.dist_repo_init('tag', ['key'], {'arch': ['x86_64'],
|
||||
'comps': 'COMPSFILE'})
|
||||
kojihub.dist_repo_init('tag', ['key'], {'arch': ['x86_64'], 'comps': 'COMPSFILE'})
|
||||
self.InsertProcessor.assert_called_once()
|
||||
|
||||
ip = self.inserts[0]
|
||||
self.assertEquals(ip.table, 'repo')
|
||||
self.assertEqual(ip.table, 'repo')
|
||||
data = {'dist': True, 'create_event': 12345, 'tag_id': 42, 'id': 99,
|
||||
'state': koji.REPO_STATES['INIT']}
|
||||
self.assertEquals(ip.data, data)
|
||||
self.assertEquals(ip.rawdata, {})
|
||||
'state': koji.REPO_STATES['INIT']}
|
||||
self.assertEqual(ip.data, data)
|
||||
self.assertEqual(ip.rawdata, {})
|
||||
|
||||
self.copyfile.assert_called_once()
|
||||
|
||||
|
|
@ -102,7 +95,7 @@ class TestDistRepo(unittest.TestCase):
|
|||
assert_policy.assert_called_once_with('dist_repo', {'tag': 'tag'})
|
||||
dist_repo_init.assert_called_once()
|
||||
make_task.assert_called_once()
|
||||
self.assertEquals(ret, make_task.return_value)
|
||||
self.assertEqual(ret, make_task.return_value)
|
||||
exports.getBuildConfig.assert_called_once_with('tag')
|
||||
|
||||
|
||||
|
|
@ -143,9 +136,9 @@ class TestDistRepoMove(unittest.TestCase):
|
|||
# generate pkglist file
|
||||
self.files.append('pkglist')
|
||||
plist = os.path.join(uploaddir, 'pkglist')
|
||||
nvrs = ['aaa-1.0-2', 'bbb-3.0-5', 'ccc-8.0-13','ddd-21.0-34']
|
||||
nvrs = ['aaa-1.0-2', 'bbb-3.0-5', 'ccc-8.0-13', 'ddd-21.0-34']
|
||||
self.rpms = {}
|
||||
self.builds ={}
|
||||
self.builds = {}
|
||||
self.key = '4c8da725'
|
||||
with open(plist, 'wt', encoding='utf-8') as f_pkglist:
|
||||
for nvr in nvrs:
|
||||
|
|
@ -192,20 +185,16 @@ class TestDistRepoMove(unittest.TestCase):
|
|||
self.get_rpm.side_effect = self.our_get_rpm
|
||||
self.get_build.side_effect = self.our_get_build
|
||||
|
||||
|
||||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
shutil.rmtree(self.topdir)
|
||||
|
||||
|
||||
def our_get_rpm(self, rpminfo, strict=False, multi=False):
|
||||
return self.rpms[rpminfo]
|
||||
|
||||
|
||||
def our_get_build(self, buildInfo, strict=False):
|
||||
return self.builds[buildInfo]
|
||||
|
||||
|
||||
def test_distRepoMove(self):
|
||||
session = kojihub.context.session = mock.MagicMock()
|
||||
session.user_id = 123
|
||||
|
|
@ -220,5 +209,4 @@ class TestDistRepoMove(unittest.TestCase):
|
|||
raise Exception("Missing file: %s" % path)
|
||||
data = open(path, 'rt', encoding='utf-8').read()
|
||||
data.strip()
|
||||
self.assertEquals(data, basename)
|
||||
|
||||
self.assertEqual(data, basename)
|
||||
|
|
|
|||
|
|
@ -16,20 +16,19 @@ class TestGetRPMDeps(unittest.TestCase):
|
|||
return None
|
||||
get_rpm.side_effect = mock_get_rpm
|
||||
re = kojihub.RootExports().getRPMDeps(1)
|
||||
self.assertEquals(re, [])
|
||||
self.assertEqual(re, [])
|
||||
with self.assertRaises(koji.GenericError) as cm:
|
||||
kojihub.RootExports().getRPMDeps(1, strict=True)
|
||||
self.assertEquals(cm.exception.args[0], 'msg')
|
||||
self.assertEqual(cm.exception.args[0], 'msg')
|
||||
|
||||
@mock.patch('kojihub.get_rpm', return_value={'id': 1, 'build_id': None})
|
||||
def test_getRPMDeps_external_rpm(self, get_rpm):
|
||||
re = kojihub.RootExports().getRPMDeps(1)
|
||||
self.assertEquals(re, [])
|
||||
self.assertEqual(re, [])
|
||||
with self.assertRaises(koji.GenericError) as cm:
|
||||
kojihub.RootExports().getRPMDeps(1, strict=True)
|
||||
self.assertEquals(cm.exception.args[0],
|
||||
'Can not get dependencies,'
|
||||
' because RPM: 1 is not internal')
|
||||
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})
|
||||
|
|
@ -38,11 +37,10 @@ class TestGetRPMDeps(unittest.TestCase):
|
|||
@mock.patch('os.path.exists', return_value=False)
|
||||
def test_getRPMDeps_no_rpmfile(self, ope, pr, pb, get_build, get_rpm):
|
||||
re = kojihub.RootExports().getRPMDeps(1)
|
||||
self.assertEquals(re, [])
|
||||
self.assertEqual(re, [])
|
||||
with self.assertRaises(koji.GenericError) as cm:
|
||||
kojihub.RootExports().getRPMDeps(1, strict=True)
|
||||
self.assertEquals(cm.exception.args[0],
|
||||
"RPM file of 1 doesn't exist")
|
||||
self.assertEqual(cm.exception.args[0], "RPM file of 1 doesn't exist")
|
||||
|
||||
@mock.patch('kojihub.get_rpm')
|
||||
@mock.patch('kojihub.get_build')
|
||||
|
|
|
|||
|
|
@ -20,20 +20,19 @@ class TestGetRPMFile(unittest.TestCase):
|
|||
|
||||
get_rpm.side_effect = mock_get_rpm
|
||||
re = kojihub.RootExports().getRPMFile(1, 'filename')
|
||||
self.assertEquals(re, {})
|
||||
self.assertEqual(re, {})
|
||||
with self.assertRaises(koji.GenericError) as cm:
|
||||
kojihub.RootExports().getRPMFile(1, 'filename', strict=True)
|
||||
self.assertEquals(cm.exception.args[0], 'msg')
|
||||
self.assertEqual(cm.exception.args[0], 'msg')
|
||||
|
||||
@mock.patch('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.assertEquals(re, {})
|
||||
self.assertEqual(re, {})
|
||||
with self.assertRaises(koji.GenericError) as cm:
|
||||
kojihub.RootExports().getRPMFile(1, 'filename', strict=True)
|
||||
self.assertEquals(cm.exception.args[0],
|
||||
'Can not get RPM file,'
|
||||
' because RPM: 1 is not internal')
|
||||
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})
|
||||
|
|
@ -42,11 +41,10 @@ class TestGetRPMFile(unittest.TestCase):
|
|||
@mock.patch('os.path.exists', return_value=False)
|
||||
def test_getRPMFile_no_rpmfile(self, ope, pr, pb, get_build, get_rpm):
|
||||
re = kojihub.RootExports().getRPMFile(1, 'filename')
|
||||
self.assertEquals(re, {})
|
||||
self.assertEqual(re, {})
|
||||
with self.assertRaises(koji.GenericError) as cm:
|
||||
kojihub.RootExports().getRPMFile(1, 'filename', strict=True)
|
||||
self.assertEquals(cm.exception.args[0],
|
||||
"RPM package file of 1 doesn't exist")
|
||||
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')
|
||||
|
|
@ -57,20 +55,20 @@ class TestGetRPMFile(unittest.TestCase):
|
|||
pi.rpm.return_value = 'test-files-1-1.fc27.noarch.rpm'
|
||||
getRPMFile = kojihub.RootExports().getRPMFile
|
||||
res = getRPMFile(1, '/fileA')
|
||||
self.assertDictEqual(res, {'digest_algo': 'sha256',
|
||||
'user': 'root',
|
||||
'mtime': int(1535536271),
|
||||
'digest': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
||||
'size': 0,
|
||||
'group': 'root',
|
||||
'name': '/fileA',
|
||||
'rpm_id': 1,
|
||||
'flags': 0,
|
||||
'mode': int(0o100755),
|
||||
'md5': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'})
|
||||
self.assertDictEqual(res, {
|
||||
'digest_algo': 'sha256',
|
||||
'user': 'root',
|
||||
'mtime': int(1535536271),
|
||||
'digest': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
||||
'size': 0,
|
||||
'group': 'root',
|
||||
'name': '/fileA',
|
||||
'rpm_id': 1,
|
||||
'flags': 0,
|
||||
'mode': int(0o100755),
|
||||
'md5': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'})
|
||||
res = getRPMFile(1, '/fileB')
|
||||
self.assertEquals(res, {})
|
||||
self.assertEqual(res, {})
|
||||
with self.assertRaises(koji.GenericError) as cm:
|
||||
res = getRPMFile(1, '/fileB', strict=True)
|
||||
self.assertEquals(cm.exception.args[0],
|
||||
'No file: /fileB found in RPM: 1')
|
||||
self.assertEqual(cm.exception.args[0], 'No file: /fileB found in RPM: 1')
|
||||
|
|
|
|||
|
|
@ -55,12 +55,13 @@ class TestImportImageInternal(unittest.TestCase):
|
|||
@mock.patch('kojihub.get_build')
|
||||
@mock.patch('kojihub.Task')
|
||||
@mock.patch('kojihub.context')
|
||||
def test_with_rpm(self, context, Task, get_build, get_archive_type, import_archive, build, work, get_rpm):
|
||||
def test_with_rpm(self, context, Task, get_build, get_archive_type, import_archive, build,
|
||||
work, get_rpm):
|
||||
task = mock.MagicMock()
|
||||
task.assertHost = mock.MagicMock()
|
||||
Task.return_value = task
|
||||
rpm = {
|
||||
#'location': 'foo',
|
||||
# 'location': 'foo',
|
||||
'id': 6,
|
||||
'name': 'foo',
|
||||
'version': '3.1',
|
||||
|
|
@ -108,13 +109,13 @@ class TestImportImageInternal(unittest.TestCase):
|
|||
# Check that the log symlink made it to where it was supposed to.
|
||||
dest = os.readlink(workdir + '/foo.log')
|
||||
dest = os.path.abspath(os.path.join(workdir, dest))
|
||||
self.assertEquals(dest, self.tempdir + '/data/logs/image/foo.log')
|
||||
self.assertEqual(dest, self.tempdir + '/data/logs/image/foo.log')
|
||||
|
||||
# And.. check all the sql statements
|
||||
self.assertEquals(len(cursor.execute.mock_calls), 1)
|
||||
self.assertEqual(len(cursor.execute.mock_calls), 1)
|
||||
expression, kwargs = cursor.execute.mock_calls[0][1]
|
||||
expression = " ".join(expression.split())
|
||||
expected = 'INSERT INTO archive_rpm_components (archive_id, rpm_id) ' + \
|
||||
'VALUES (%(archive_id0)s, %(rpm_id0)s)'
|
||||
self.assertEquals(expression, expected)
|
||||
self.assertEquals(kwargs, {'archive_id0': 9, 'rpm_id0': 6})
|
||||
self.assertEqual(expression, expected)
|
||||
self.assertEqual(kwargs, {'archive_id0': 9, 'rpm_id0': 6})
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@ class TestInsertProcessor(unittest.TestCase):
|
|||
proc = kojihub.InsertProcessor('sometable')
|
||||
actual = str(proc)
|
||||
expected = '-- incomplete update: no assigns'
|
||||
self.assertEquals(actual, expected)
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
def test_to_string_with_data(self):
|
||||
proc = kojihub.InsertProcessor('sometable', data={'foo': 'bar'})
|
||||
actual = str(proc)
|
||||
expected = 'INSERT INTO sometable (foo) VALUES (%(foo)s)'
|
||||
self.assertEquals(actual, expected)
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
@mock.patch('kojihub.context')
|
||||
def test_simple_execution_with_iterate(self, context):
|
||||
|
|
@ -37,20 +37,20 @@ class TestInsertProcessor(unittest.TestCase):
|
|||
context.session.assertLogin = mock.MagicMock()
|
||||
proc = kojihub.InsertProcessor('sometable', data={'foo': 'bar'})
|
||||
proc.make_create(event_id=1, user_id=2)
|
||||
self.assertEquals(proc.data['create_event'], 1)
|
||||
self.assertEquals(proc.data['creator_id'], 2)
|
||||
self.assertEqual(proc.data['create_event'], 1)
|
||||
self.assertEqual(proc.data['creator_id'], 2)
|
||||
|
||||
proc.make_create(user_id=2)
|
||||
self.assertEquals(proc.data['create_event'], context.event_id)
|
||||
self.assertEquals(proc.data['creator_id'], 2)
|
||||
self.assertEqual(proc.data['create_event'], context.event_id)
|
||||
self.assertEqual(proc.data['creator_id'], 2)
|
||||
|
||||
proc.make_create(event_id=1)
|
||||
self.assertEquals(proc.data['create_event'], 1)
|
||||
self.assertEquals(proc.data['creator_id'], context.session.user_id)
|
||||
self.assertEqual(proc.data['create_event'], 1)
|
||||
self.assertEqual(proc.data['creator_id'], context.session.user_id)
|
||||
|
||||
proc.make_create()
|
||||
self.assertEquals(proc.data['create_event'], context.event_id)
|
||||
self.assertEquals(proc.data['creator_id'], context.session.user_id)
|
||||
self.assertEqual(proc.data['create_event'], context.event_id)
|
||||
self.assertEqual(proc.data['creator_id'], context.session.user_id)
|
||||
|
||||
@mock.patch('kojihub.context')
|
||||
def test_dup_check(self, context):
|
||||
|
|
@ -63,7 +63,7 @@ class TestInsertProcessor(unittest.TestCase):
|
|||
args = cursor.execute.call_args
|
||||
actual = ' '.join(args[0][0].split())
|
||||
expected = 'SELECT foo FROM sometable WHERE (foo = %(foo)s)'
|
||||
self.assertEquals(actual, expected)
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
proc.make_create()
|
||||
proc.dup_check()
|
||||
|
|
@ -71,12 +71,12 @@ class TestInsertProcessor(unittest.TestCase):
|
|||
actual = ' '.join(args[0][0].split())
|
||||
expected = 'SELECT active, foo FROM sometable WHERE ' + \
|
||||
'(active = %(active)s) AND (foo = %(foo)s)'
|
||||
self.assertEquals(actual, expected)
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
proc.set(onething='another')
|
||||
proc.rawset(something='something else')
|
||||
result = proc.dup_check()
|
||||
self.assertEquals(result, None)
|
||||
self.assertEqual(result, None)
|
||||
|
||||
@mock.patch('kojihub.context')
|
||||
def test_raw_data(self, context):
|
||||
|
|
@ -84,10 +84,10 @@ class TestInsertProcessor(unittest.TestCase):
|
|||
context.cnx.cursor.return_value = cursor
|
||||
proc = kojihub.InsertProcessor('sometable', rawdata={'foo': '\'bar\''})
|
||||
result = proc.dup_check()
|
||||
self.assertEquals(result, None)
|
||||
self.assertEqual(result, None)
|
||||
actual = str(proc)
|
||||
expected = "INSERT INTO sometable (foo) VALUES (('bar'))" # raw data
|
||||
self.assertEquals(actual, expected)
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
|
||||
class TestBulkInsertProcessor(unittest.TestCase):
|
||||
|
|
@ -95,18 +95,18 @@ class TestBulkInsertProcessor(unittest.TestCase):
|
|||
proc = kojihub.BulkInsertProcessor('sometable')
|
||||
actual = str(proc)
|
||||
expected = '-- incomplete insert: no data'
|
||||
self.assertEquals(actual, expected)
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
def test_to_string_with_single_row(self):
|
||||
proc = kojihub.BulkInsertProcessor('sometable', data=[{'foo': 'bar'}])
|
||||
actual = str(proc)
|
||||
expected = 'INSERT INTO sometable (foo) VALUES (%(foo0)s)'
|
||||
self.assertEquals(actual, expected)
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
proc = kojihub.BulkInsertProcessor('sometable')
|
||||
proc.add_record(foo='bar')
|
||||
actual = str(proc)
|
||||
self.assertEquals(actual, expected)
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
@mock.patch('kojihub.context')
|
||||
def test_simple_execution(self, context):
|
||||
|
|
@ -148,7 +148,7 @@ class TestBulkInsertProcessor(unittest.TestCase):
|
|||
proc.add_record(foo2='bar2')
|
||||
with self.assertRaises(koji.GenericError) as cm:
|
||||
str(proc)
|
||||
self.assertEquals(cm.exception.args[0], 'Missing value foo2 in BulkInsert')
|
||||
self.assertEqual(cm.exception.args[0], 'Missing value foo2 in BulkInsert')
|
||||
|
||||
def test_missing_values_nostrict(self):
|
||||
proc = kojihub.BulkInsertProcessor('sometable', strict=False)
|
||||
|
|
@ -156,14 +156,14 @@ class TestBulkInsertProcessor(unittest.TestCase):
|
|||
proc.add_record(foo2='bar2')
|
||||
actual = str(proc)
|
||||
expected = 'INSERT INTO sometable (foo, foo2) VALUES (%(foo0)s, NULL), (NULL, %(foo21)s)'
|
||||
self.assertEquals(actual, expected)
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
def test_missing_values_explicit_columns(self):
|
||||
proc = kojihub.BulkInsertProcessor('sometable', strict=True, columns=['foo', 'foo2'])
|
||||
proc.add_record(foo='bar')
|
||||
with self.assertRaises(koji.GenericError) as cm:
|
||||
str(proc)
|
||||
self.assertEquals(cm.exception.args[0], 'Missing value foo2 in BulkInsert')
|
||||
self.assertEqual(cm.exception.args[0], 'Missing value foo2 in BulkInsert')
|
||||
|
||||
@mock.patch('kojihub.context')
|
||||
def test_batch_execution(self, context):
|
||||
|
|
@ -176,15 +176,12 @@ class TestBulkInsertProcessor(unittest.TestCase):
|
|||
proc.execute()
|
||||
calls = cursor.execute.mock_calls
|
||||
# list of (name, positional args, keyword args)
|
||||
self.assertEquals(len(calls), 2)
|
||||
self.assertEquals(
|
||||
calls[0][1],
|
||||
('INSERT INTO sometable (foo) VALUES (%(foo0)s), (%(foo1)s)',
|
||||
{'foo0': 'bar1', 'foo1': 'bar2'}))
|
||||
self.assertEquals(
|
||||
calls[1][1],
|
||||
('INSERT INTO sometable (foo) VALUES (%(foo0)s)',
|
||||
{'foo0': 'bar3'}))
|
||||
self.assertEqual(len(calls), 2)
|
||||
self.assertEqual(calls[0][1],
|
||||
('INSERT INTO sometable (foo) VALUES (%(foo0)s), (%(foo1)s)',
|
||||
{'foo0': 'bar1', 'foo1': 'bar2'}))
|
||||
self.assertEqual(calls[1][1],
|
||||
('INSERT INTO sometable (foo) VALUES (%(foo0)s)', {'foo0': 'bar3'}))
|
||||
|
||||
@mock.patch('kojihub.context')
|
||||
def test_no_batch_execution(self, context):
|
||||
|
|
@ -197,8 +194,7 @@ class TestBulkInsertProcessor(unittest.TestCase):
|
|||
proc.execute()
|
||||
calls = cursor.execute.mock_calls
|
||||
# list of (name, positional args, keyword args)
|
||||
self.assertEquals(len(calls), 1)
|
||||
self.assertEquals(
|
||||
calls[0][1],
|
||||
('INSERT INTO sometable (foo) VALUES (%(foo0)s), (%(foo1)s), (%(foo2)s)',
|
||||
{'foo0': 'bar1', 'foo1': 'bar2', 'foo2': 'bar3'}))
|
||||
self.assertEqual(len(calls), 1)
|
||||
self.assertEqual(calls[0][1],
|
||||
('INSERT INTO sometable (foo) VALUES (%(foo0)s), (%(foo1)s), (%(foo2)s)',
|
||||
{'foo0': 'bar1', 'foo1': 'bar2', 'foo2': 'bar3'}))
|
||||
|
|
|
|||
|
|
@ -17,15 +17,15 @@ class TestListBTypes(unittest.TestCase):
|
|||
ret = kojihub.list_btypes()
|
||||
QueryProcessor.assert_called_once()
|
||||
query.execute.assert_called_once()
|
||||
self.assertEquals(ret, "return value")
|
||||
self.assertEqual(ret, "return value")
|
||||
|
||||
args, kwargs = QueryProcessor.call_args
|
||||
self.assertEquals(args, ())
|
||||
self.assertEqual(args, ())
|
||||
qp = QP(**kwargs)
|
||||
self.assertEquals(qp.tables, ['btype'])
|
||||
self.assertEquals(qp.columns, ['id', 'name'])
|
||||
self.assertEquals(qp.clauses, [])
|
||||
self.assertEquals(qp.joins, None)
|
||||
self.assertEqual(qp.tables, ['btype'])
|
||||
self.assertEqual(qp.columns, ['id', 'name'])
|
||||
self.assertEqual(qp.clauses, [])
|
||||
self.assertEqual(qp.joins, None)
|
||||
|
||||
QueryProcessor.reset_mock()
|
||||
|
||||
|
|
@ -35,16 +35,16 @@ class TestListBTypes(unittest.TestCase):
|
|||
ret = kojihub.list_btypes({'name': 'rpm'})
|
||||
QueryProcessor.assert_called_once()
|
||||
query.execute.assert_called_once()
|
||||
self.assertEquals(ret, "return value")
|
||||
self.assertEqual(ret, "return value")
|
||||
|
||||
args, kwargs = QueryProcessor.call_args
|
||||
self.assertEquals(args, ())
|
||||
self.assertEqual(args, ())
|
||||
qp = QP(**kwargs)
|
||||
self.assertEquals(qp.tables, ['btype'])
|
||||
self.assertEquals(qp.columns, ['id', 'name'])
|
||||
self.assertEquals(qp.clauses, ['btype.name = %(name)s'])
|
||||
self.assertEquals(qp.values, {'name': 'rpm'})
|
||||
self.assertEquals(qp.joins, None)
|
||||
self.assertEqual(qp.tables, ['btype'])
|
||||
self.assertEqual(qp.columns, ['id', 'name'])
|
||||
self.assertEqual(qp.clauses, ['btype.name = %(name)s'])
|
||||
self.assertEqual(qp.values, {'name': 'rpm'})
|
||||
self.assertEqual(qp.joins, None)
|
||||
|
||||
QueryProcessor.reset_mock()
|
||||
|
||||
|
|
@ -54,17 +54,17 @@ class TestListBTypes(unittest.TestCase):
|
|||
ret = kojihub.list_btypes({'id': 1}, {'order': 'id'})
|
||||
QueryProcessor.assert_called_once()
|
||||
query.execute.assert_called_once()
|
||||
self.assertEquals(ret, "return value")
|
||||
self.assertEqual(ret, "return value")
|
||||
|
||||
args, kwargs = QueryProcessor.call_args
|
||||
self.assertEquals(args, ())
|
||||
self.assertEqual(args, ())
|
||||
qp = QP(**kwargs)
|
||||
self.assertEquals(qp.tables, ['btype'])
|
||||
self.assertEquals(qp.columns, ['id', 'name'])
|
||||
self.assertEquals(qp.clauses, ['btype.id = %(id)s'])
|
||||
self.assertEquals(qp.values, {'id': 1})
|
||||
self.assertEquals(qp.opts, {'order': 'id'})
|
||||
self.assertEquals(qp.joins, None)
|
||||
self.assertEqual(qp.tables, ['btype'])
|
||||
self.assertEqual(qp.columns, ['id', 'name'])
|
||||
self.assertEqual(qp.clauses, ['btype.id = %(id)s'])
|
||||
self.assertEqual(qp.values, {'id': 1})
|
||||
self.assertEqual(qp.opts, {'order': 'id'})
|
||||
self.assertEqual(qp.joins, None)
|
||||
|
||||
QueryProcessor.reset_mock()
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class TestListBuilds(unittest.TestCase):
|
|||
package = 'test-package'
|
||||
kojihub.get_package_id.return_value = None
|
||||
rv = self.exports.listBuilds(packageID=package)
|
||||
self.assertEquals(rv, [])
|
||||
self.assertEqual(rv, [])
|
||||
|
||||
@mock.patch('kojihub.get_package_id')
|
||||
def test_package_string(self, get_package_id):
|
||||
|
|
@ -57,27 +57,27 @@ class TestListBuilds(unittest.TestCase):
|
|||
self.assertEqual(len(self.queries), 1)
|
||||
args, kwargs = self.QueryProcessor.call_args
|
||||
qp = QP(**kwargs)
|
||||
self.assertEquals(qp.tables, ['build'])
|
||||
self.assertEquals(qp.columns, ['build.id', 'build.completion_time',
|
||||
'EXTRACT(EPOCH FROM build.completion_time)',
|
||||
'events.id', 'events.time',
|
||||
'EXTRACT(EPOCH FROM events.time)', 'build.epoch',
|
||||
'build.extra', 'package.name',
|
||||
"package.name || '-' || build.version || '-' || "
|
||||
"build.release", 'users.id', 'users.name', 'package.id',
|
||||
'package.name', 'build.release', 'build.source',
|
||||
'build.start_time', 'EXTRACT(EPOCH FROM build.start_time)',
|
||||
'build.state', 'build.task_id', 'build.version',
|
||||
'volume.id', 'volume.name'])
|
||||
self.assertEqual(qp.tables, ['build'])
|
||||
self.assertEqual(qp.columns, ['build.id', 'build.completion_time',
|
||||
'EXTRACT(EPOCH FROM build.completion_time)',
|
||||
'events.id', 'events.time',
|
||||
'EXTRACT(EPOCH FROM events.time)', 'build.epoch',
|
||||
'build.extra', 'package.name',
|
||||
"package.name || '-' || build.version || '-' || "
|
||||
"build.release", 'users.id', 'users.name', 'package.id',
|
||||
'package.name', 'build.release', 'build.source',
|
||||
'build.start_time', 'EXTRACT(EPOCH FROM build.start_time)',
|
||||
'build.state', 'build.task_id', 'build.version',
|
||||
'volume.id', 'volume.name'])
|
||||
self.assertEqual(qp.clauses, ['package.id = %(packageID)i'])
|
||||
self.assertEquals(qp.joins, ['LEFT JOIN events ON build.create_event = events.id',
|
||||
'LEFT JOIN package ON build.pkg_id = package.id',
|
||||
'LEFT JOIN volume ON build.volume_id = volume.id',
|
||||
'LEFT JOIN users ON build.owner = users.id'])
|
||||
self.assertEqual(qp.joins, ['LEFT JOIN events ON build.create_event = events.id',
|
||||
'LEFT JOIN package ON build.pkg_id = package.id',
|
||||
'LEFT JOIN volume ON build.volume_id = volume.id',
|
||||
'LEFT JOIN users ON build.owner = users.id'])
|
||||
|
||||
@mock.patch('kojihub.get_user')
|
||||
def test_wrong_user(self, get_user):
|
||||
user = 'test-user'
|
||||
get_user.return_value = None
|
||||
rv = self.exports.listBuilds(userID=user)
|
||||
self.assertEquals(rv, [])
|
||||
self.assertEqual(rv, [])
|
||||
|
|
|
|||
|
|
@ -47,64 +47,63 @@ class TestHost(unittest.TestCase):
|
|||
def test_task_unwait(self, context, processor):
|
||||
host = kojihub.Host(id=1234)
|
||||
host.taskUnwait(parent=123)
|
||||
self.assertEquals(len(processor.mock_calls), 6)
|
||||
self.assertEqual(len(processor.mock_calls), 6)
|
||||
update1 = mock.call(
|
||||
'task',
|
||||
clauses=['id=%(parent)s'],
|
||||
values=mock.ANY,
|
||||
)
|
||||
self.assertEquals(processor.call_args_list[0], update1)
|
||||
self.assertEqual(processor.call_args_list[0], update1)
|
||||
update2 = mock.call(
|
||||
'task',
|
||||
clauses=['parent=%(parent)s'],
|
||||
values=mock.ANY,
|
||||
)
|
||||
self.assertEquals(processor.call_args_list[1], update2)
|
||||
|
||||
self.assertEqual(processor.call_args_list[1], update2)
|
||||
|
||||
@mock.patch('kojihub.UpdateProcessor')
|
||||
@mock.patch('kojihub.context')
|
||||
def test_task_set_wait_all_tasks(self, context, processor):
|
||||
host = kojihub.Host(id=1234)
|
||||
host.taskSetWait(parent=123, tasks=None)
|
||||
self.assertEquals(len(processor.mock_calls), 6)
|
||||
self.assertEqual(len(processor.mock_calls), 6)
|
||||
update1 = mock.call(
|
||||
'task',
|
||||
clauses=['id=%(parent)s'],
|
||||
values=mock.ANY,
|
||||
)
|
||||
self.assertEquals(processor.call_args_list[0], update1)
|
||||
self.assertEqual(processor.call_args_list[0], update1)
|
||||
update2 = mock.call(
|
||||
'task',
|
||||
clauses=['parent=%(parent)s'],
|
||||
values=mock.ANY,
|
||||
)
|
||||
self.assertEquals(processor.call_args_list[1], update2)
|
||||
self.assertEqual(processor.call_args_list[1], update2)
|
||||
|
||||
@mock.patch('kojihub.UpdateProcessor')
|
||||
@mock.patch('kojihub.context')
|
||||
def test_task_set_wait_some_tasks(self, context, processor):
|
||||
host = kojihub.Host(id=1234)
|
||||
host.taskSetWait(parent=123, tasks=[234, 345])
|
||||
self.assertEquals(len(processor.mock_calls), 9)
|
||||
self.assertEqual(len(processor.mock_calls), 9)
|
||||
update1 = mock.call(
|
||||
'task',
|
||||
clauses=['id=%(parent)s'],
|
||||
values=mock.ANY,
|
||||
)
|
||||
self.assertEquals(processor.call_args_list[0], update1)
|
||||
self.assertEqual(processor.call_args_list[0], update1)
|
||||
update2 = mock.call(
|
||||
'task',
|
||||
clauses=['id IN %(tasks)s', 'parent=%(parent)s'],
|
||||
values=mock.ANY,
|
||||
)
|
||||
self.assertEquals(processor.call_args_list[1], update2)
|
||||
self.assertEqual(processor.call_args_list[1], update2)
|
||||
update3 = mock.call(
|
||||
'task',
|
||||
clauses=['id NOT IN %(tasks)s', 'parent=%(parent)s', 'awaited=true'],
|
||||
values=mock.ANY,
|
||||
)
|
||||
self.assertEquals(processor.call_args_list[2], update3)
|
||||
self.assertEqual(processor.call_args_list[2], update3)
|
||||
|
||||
@mock.patch('kojihub.context')
|
||||
def test_task_wait_check(self, context):
|
||||
|
|
@ -119,8 +118,8 @@ class TestHost(unittest.TestCase):
|
|||
host = kojihub.Host(id=1234)
|
||||
finished, unfinished = host.taskWaitCheck(parent=123)
|
||||
cursor.execute.assert_called_once()
|
||||
self.assertEquals(finished, [2, 3])
|
||||
self.assertEquals(unfinished, [1, 4])
|
||||
self.assertEqual(finished, [2, 3])
|
||||
self.assertEqual(unfinished, [1, 4])
|
||||
|
||||
@mock.patch('kojihub.context')
|
||||
def test_task_wait(self, context):
|
||||
|
|
@ -134,4 +133,4 @@ class TestHost(unittest.TestCase):
|
|||
]
|
||||
host = kojihub.Host(id=1234)
|
||||
host.taskWait(parent=123)
|
||||
self.assertEquals(len(cursor.execute.mock_calls), 3)
|
||||
self.assertEqual(len(cursor.execute.mock_calls), 3)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import mock
|
||||
import unittest
|
||||
|
||||
import koji
|
||||
import kojihub
|
||||
|
|
@ -6,14 +7,12 @@ import kojihub
|
|||
QP = kojihub.QueryProcessor
|
||||
UP = kojihub.UpdateProcessor
|
||||
|
||||
class TestRecycleBuild():
|
||||
# NOT a subclass of unittest.TestCase so that we can use generator
|
||||
# methods
|
||||
|
||||
class TestRecycleBuild(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor').start()
|
||||
self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',
|
||||
side_effect=self.getUpdate).start()
|
||||
side_effect=self.getUpdate).start()
|
||||
self._dml = mock.patch('kojihub._dml').start()
|
||||
self.run_callbacks = mock.patch('koji.plugin.run_callbacks').start()
|
||||
self.rmtree = mock.patch('koji.util.rmtree').start()
|
||||
|
|
@ -70,6 +69,17 @@ class TestRecycleBuild():
|
|||
self._dml.assert_not_called()
|
||||
self.run_callbacks.assert_not_called()
|
||||
|
||||
def run_fail(self, old, new):
|
||||
try:
|
||||
kojihub.recycle_build(old, new)
|
||||
except koji.GenericError:
|
||||
pass
|
||||
else:
|
||||
raise Exception("expected koji.GenericError")
|
||||
self.UpdateProcessor.assert_not_called()
|
||||
self._dml.assert_not_called()
|
||||
self.run_callbacks.assert_not_called()
|
||||
|
||||
def test_recycle_building_bad(self):
|
||||
new = self.new.copy()
|
||||
old = self.old.copy()
|
||||
|
|
@ -109,17 +119,6 @@ class TestRecycleBuild():
|
|||
assert update.clauses == ['id=%(id)s']
|
||||
assert update.values['id'] == old['id']
|
||||
|
||||
def run_fail(self, old, new):
|
||||
try:
|
||||
kojihub.recycle_build(old, new)
|
||||
except koji.GenericError:
|
||||
pass
|
||||
else:
|
||||
raise Exception("expected koji.GenericError")
|
||||
self.UpdateProcessor.assert_not_called()
|
||||
self._dml.assert_not_called()
|
||||
self.run_callbacks.assert_not_called()
|
||||
|
||||
def test_recycle_states_bad(self):
|
||||
for state in 'BUILDING', 'COMPLETE', 'DELETED':
|
||||
yield self.check_recycle_states_bad, koji.BUILD_STATES[state]
|
||||
|
|
@ -139,7 +138,7 @@ class TestRecycleBuild():
|
|||
[[], [], True],
|
||||
[True, [], []],
|
||||
[[], True, []],
|
||||
]
|
||||
]
|
||||
for values in vlists:
|
||||
yield self.check_recycle_query_bad, values
|
||||
|
||||
|
|
@ -153,4 +152,3 @@ class TestRecycleBuild():
|
|||
query = self.QueryProcessor.return_value
|
||||
query.execute.side_effect = values
|
||||
self.run_fail(old, new)
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ class TestRPMDiff(unittest.TestCase):
|
|||
d.differs.return_value = False
|
||||
Rpmdiff.return_value = d
|
||||
self.assertFalse(kojihub.rpmdiff('basepath', ['12/1234/foo', '23/2345/bar'], hashes={}))
|
||||
Rpmdiff.assert_called_once_with('basepath/12/1234/foo', 'basepath/23/2345/bar', ignore='S5TN')
|
||||
Rpmdiff.assert_called_once_with(
|
||||
'basepath/12/1234/foo', 'basepath/23/2345/bar', ignore='S5TN')
|
||||
|
||||
@mock.patch('koji.rpmdiff.Rpmdiff')
|
||||
def test_rpmdiff_simple_failure(self, Rpmdiff):
|
||||
|
|
@ -31,7 +32,8 @@ class TestRPMDiff(unittest.TestCase):
|
|||
Rpmdiff.return_value = d
|
||||
with self.assertRaises(koji.BuildError):
|
||||
kojihub.rpmdiff('basepath', ['12/1234/foo', '13/1345/bar'], hashes={})
|
||||
Rpmdiff.assert_called_once_with('basepath/12/1234/foo', 'basepath/13/1345/bar', ignore='S5TN')
|
||||
Rpmdiff.assert_called_once_with(
|
||||
'basepath/12/1234/foo', 'basepath/13/1345/bar', ignore='S5TN')
|
||||
d.textdiff.assert_called_once_with()
|
||||
|
||||
def test_rpmdiff_real_target(self):
|
||||
|
|
@ -88,10 +90,11 @@ class TestRPMDiff(unittest.TestCase):
|
|||
# dummy file info
|
||||
defattr = [19, 33188, 1531970408, 0, 0, 2, 1, -1, -1, 'root', 'root', '02d2c91b']
|
||||
|
||||
rpm_dict_old = {'a_file': defattr }
|
||||
rpm_dict_old = {'a_file': defattr}
|
||||
|
||||
def check_diff_result(opt, idx, value, textdiff):
|
||||
orig_init = koji.rpmdiff.Rpmdiff.__init__
|
||||
|
||||
def init_mock(*args, **kwargs):
|
||||
# need to init rpm_dict every time
|
||||
attr = defattr[:]
|
||||
|
|
@ -147,14 +150,14 @@ class TestCheckNoarchRpms(unittest.TestCase):
|
|||
def test_check_noarch_rpms_empty_invocation(self, rpmdiff):
|
||||
originals = ['foo', 'bar']
|
||||
result = kojihub.check_noarch_rpms('basepath', copy.copy(originals))
|
||||
self.assertEquals(result, originals)
|
||||
self.assertEqual(result, originals)
|
||||
|
||||
@mock.patch('kojihub.rpmdiff')
|
||||
def test_check_noarch_rpms_simple_invocation(self, rpmdiff):
|
||||
originals = ['12/1234/foo.noarch.rpm', '23/2345/foo.noarch.rpm']
|
||||
result = kojihub.check_noarch_rpms('basepath', copy.copy(originals))
|
||||
self.assertEquals(result, originals[0:1])
|
||||
self.assertEquals(len(rpmdiff.mock_calls), 1)
|
||||
self.assertEqual(result, originals[0:1])
|
||||
self.assertEqual(len(rpmdiff.mock_calls), 1)
|
||||
|
||||
@mock.patch('kojihub.rpmdiff')
|
||||
def test_check_noarch_rpms_with_duplicates(self, rpmdiff):
|
||||
|
|
@ -164,7 +167,7 @@ class TestCheckNoarchRpms(unittest.TestCase):
|
|||
'bar.noarch.rpm',
|
||||
]
|
||||
result = kojihub.check_noarch_rpms('basepath', copy.copy(originals))
|
||||
self.assertEquals(result, ['bar.noarch.rpm'])
|
||||
self.assertEqual(result, ['bar.noarch.rpm'])
|
||||
rpmdiff.assert_called_once_with('basepath', originals, hashes={})
|
||||
|
||||
@mock.patch('kojihub.rpmdiff')
|
||||
|
|
@ -176,7 +179,7 @@ class TestCheckNoarchRpms(unittest.TestCase):
|
|||
'bar.noarch.rpm',
|
||||
]
|
||||
result = kojihub.check_noarch_rpms('basepath', copy.copy(originals))
|
||||
self.assertEquals(result, [
|
||||
self.assertEqual(result, [
|
||||
'foo.x86_64.rpm', 'bar.x86_64.rpm', 'bar.noarch.rpm'
|
||||
])
|
||||
rpmdiff.assert_called_once_with(
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@ class TestUpdateProcessor(unittest.TestCase):
|
|||
proc = kojihub.UpdateProcessor('sometable', data={'foo': 'bar'})
|
||||
actual = str(proc)
|
||||
expected = 'UPDATE sometable SET foo = %(data.foo)s'
|
||||
self.assertEquals(actual, expected)
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
def test_to_values_from_data(self):
|
||||
proc = kojihub.UpdateProcessor('sometable', data={'foo': 'bar'})
|
||||
actual = proc.get_values()
|
||||
expected = {'data.foo': 'bar'}
|
||||
self.assertEquals(actual, expected)
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
@mock.patch('kojihub.context')
|
||||
def test_simple_execution_with_iterate(self, context):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue