refactor get_rpm
This commit is contained in:
parent
62e010d44e
commit
af36318ead
4 changed files with 78 additions and 124 deletions
|
|
@ -64,7 +64,7 @@ class TestRpminfo(utils.CliTestCase):
|
|||
'version': '1.1',
|
||||
'payloadhash': 'b2b95550390e5f213fc25f33822425f7',
|
||||
'size': 7030}]
|
||||
self.error_format = """Usage: %s rpminfo [options] <n-v-r.a> [<n-v-r.a> ...]
|
||||
self.error_format = """Usage: %s rpminfo [options] <n-v-r.a|id> [<n-v-r.a|id> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
%s: error: {message}
|
||||
|
|
@ -171,42 +171,6 @@ Used in 1 buildroots:
|
|||
arches='src')
|
||||
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=StringIO)
|
||||
def test_handle_rpminfo_with_build(self, stdout):
|
||||
rpm_nvra = 'test-rpm-1.1-11.noarch'
|
||||
self.session.getBuildroot.return_value = self.buildroot_info
|
||||
self.session.listBuildroots.return_value = [self.buildroot_info]
|
||||
self.session.getBuild.return_value = self.buildinfo
|
||||
self.session.getRPM.return_value = self.getrpminfo
|
||||
self.session.listRPMs.return_value = self.listrpminfos
|
||||
expected_output = """RPM: 7:test-rpm-1.1-11.noarch [294]
|
||||
Build: test-rpm-1.1-11 [1]
|
||||
RPM Path: /mnt/koji/packages/test-rpm/1.1/11/noarch/test-rpm-1.1-11.noarch.rpm
|
||||
SRPM: 7:test-rpm-1.1-11 [290]
|
||||
SRPM Path: /mnt/koji/packages/test-rpm/1.1/11/src/test-rpm-1.1-11.src.rpm
|
||||
Built: Tue, 16 Mar 2021 06:56:49 UTC
|
||||
SIGMD5: b2b95550390e5f213fc25f33822425f7
|
||||
Size: 7030
|
||||
Build ID: 1
|
||||
Buildroot: 3 (tag test-tag, arch x86_64, repo 2)
|
||||
Build Host: kojibuilder
|
||||
Build Task: 10
|
||||
Used in 1 buildroots:
|
||||
id build tag arch build host
|
||||
-------- ---------------------------- -------- -----------------------------
|
||||
3 test-tag x86_64 kojibuilder
|
||||
"""
|
||||
|
||||
anon_handle_rpminfo(self.options, self.session, ['--buildroot', '--build', 'any', rpm_nvra])
|
||||
self.assert_console_message(stdout, expected_output)
|
||||
self.session.getBuildroot.assert_called_once_with(self.getrpminfo['buildroot_id'])
|
||||
self.session.listBuildroots.assert_called_once_with(queryOpts={'order': 'buildroot.id'},
|
||||
rpmID=self.getrpminfo['id'])
|
||||
self.session.getBuild.assert_called_once_with(self.getrpminfo['build_id'])
|
||||
self.session.getRPM.assert_called_once_with(rpm_nvra, build='any')
|
||||
self.session.listRPMs.assert_called_once_with(buildID=self.getrpminfo['build_id'],
|
||||
arches='src')
|
||||
|
||||
def test_rpminfo_without_option(self):
|
||||
arguments = []
|
||||
self.assert_system_exit(
|
||||
|
|
@ -223,11 +187,10 @@ Used in 1 buildroots:
|
|||
def test_rpminfo_help(self):
|
||||
self.assert_help(
|
||||
anon_handle_rpminfo,
|
||||
"""Usage: %s rpminfo [options] <n-v-r.a> [<n-v-r.a> ...]
|
||||
"""Usage: %s rpminfo [options] <n-v-r.a|id> [<n-v-r.a|id> ...]
|
||||
(Specify the --help global option for a list of other help options)
|
||||
|
||||
Options:
|
||||
-h, --help show this help message and exit
|
||||
--buildroots show buildroots the rpm was used in
|
||||
--build=NVR|ID show the rpm(s) in the build
|
||||
-h, --help show this help message and exit
|
||||
--buildroots show buildroots the rpm was used in
|
||||
""" % self.progname)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue