queryRPMSigs accepts RPM ID, NVRA and dict
Fixes: https://pagure.io/koji/issue/3061
This commit is contained in:
parent
113736b231
commit
46411b25a3
2 changed files with 72 additions and 1 deletions
63
tests/test_hub/test_query_rpm_sigs.py
Normal file
63
tests/test_hub/test_query_rpm_sigs.py
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
import unittest
|
||||
|
||||
import mock
|
||||
|
||||
import kojihub
|
||||
|
||||
QP = kojihub.QueryProcessor
|
||||
|
||||
|
||||
class TestQueryRPMSigs(unittest.TestCase):
|
||||
|
||||
def getQuery(self, *args, **kwargs):
|
||||
query = QP(*args, **kwargs)
|
||||
query.execute = mock.MagicMock()
|
||||
self.queries.append(query)
|
||||
return query
|
||||
|
||||
def setUp(self):
|
||||
self.QueryProcessor = mock.patch('kojihub.QueryProcessor',
|
||||
side_effect=self.getQuery).start()
|
||||
self.queries = []
|
||||
self.get_rpm = mock.patch('kojihub.get_rpm').start()
|
||||
self.rinfo = {'arch': 'x86_64',
|
||||
'build_id': 1,
|
||||
'buildroot_id': None,
|
||||
'buildtime': 1564782768,
|
||||
'epoch': None,
|
||||
'external_repo_id': None,
|
||||
'extra': None,
|
||||
'id': 1234,
|
||||
'metadata_only': False,
|
||||
'name': 'fs_mark',
|
||||
'payloadhash': 'ed0690ab4b0508f2448d99a08e0a004a',
|
||||
'release': '20.el8',
|
||||
'size': 25644,
|
||||
'version': '3.3'}
|
||||
|
||||
def test_rpm_dict(self):
|
||||
rinfo_dict = {
|
||||
'arch': 'x86_64',
|
||||
'name': 'fs_mark',
|
||||
'release': '20.el8',
|
||||
'version': '3.3'
|
||||
}
|
||||
self.get_rpm.return_value = self.rinfo
|
||||
kojihub.query_rpm_sigs(rpm_id=rinfo_dict)
|
||||
self.get_rpm.assert_called_once_with(rinfo_dict)
|
||||
|
||||
def test_rpm_nvra(self):
|
||||
nvra = 'fs_mark-3.3-20.el8.x86_64'
|
||||
self.get_rpm.return_value = self.rinfo
|
||||
kojihub.query_rpm_sigs(rpm_id=nvra)
|
||||
self.get_rpm.assert_called_once_with(nvra)
|
||||
|
||||
def test_rpm_int(self):
|
||||
rpm_id = 1234
|
||||
kojihub.query_rpm_sigs(rpm_id=rpm_id)
|
||||
self.get_rpm.assert_not_called()
|
||||
|
||||
def test_rpm_str_int(self):
|
||||
rpm_id = '1234'
|
||||
kojihub.query_rpm_sigs(rpm_id=rpm_id)
|
||||
self.get_rpm.assert_called_once_with(rpm_id)
|
||||
Loading…
Add table
Add a link
Reference in a new issue