Skip to content

Commit

Permalink
Change usage of add_remote_rpm according to new API
Browse files Browse the repository at this point in the history
The function add_remote_rpm now requires list of paths and returns list.
  • Loading branch information
j-mracek authored and MichaelMraka committed Jun 29, 2016
1 parent 67d77a1 commit c2965d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions plugins/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ def _get_source_packages(pkgs):
def _get_query(self, pkg_spec):
"""Return a query to match a pkg_spec."""
if os.path.exists(pkg_spec):
pkg = self.base.add_remote_rpm(pkg_spec)
pkg_spec = "{0.name}-{0.epoch}:{0.version}-{0.release}.{0.arch}".format(pkg)
pkgs = self.base.add_remote_rpms([pkg_spec])
pkg_spec = "{0.name}-{0.epoch}:{0.version}-{0.release}.{0.arch}".format(pkgs[0])

subj = dnf.subject.Subject(pkg_spec)
q = subj.get_best_query(self.base.sack)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def setUp(self):
cli = mock.MagicMock()
self.cmd = download.DownloadCommand(cli)
self.cmd.cli.base = dnf.cli.cli.BaseCli()
self.cmd.cli.base.add_remote_rpm = mock.Mock()
self.cmd.cli.base.add_remote_rpms = mock.MagicMock()
self.cmd.cli.base.download_packages = mock.Mock()

# point the Sack and Subject to out stubs
Expand Down Expand Up @@ -335,12 +335,12 @@ def test_get_query(self):
def test_get_query_with_local_rpm(self):
try:
(fs, rpm_path) = tempfile.mkstemp('foobar-99.99-1.x86_64.rpm')
# b/c self.cmd.cli.base.add_remote_rpm is a mock object it
# b/c self.cmd.cli.base.add_remote_rpms is a mock object it
# will not update the available packages while testing.
# it is expected to hit this exception
with self.assertRaises(dnf.exceptions.PackageNotFoundError):
self.cmd._get_query(rpm_path)
self.cmd.cli.base.add_remote_rpm.assert_called_with(rpm_path)
self.cmd.cli.base.add_remote_rpms.assert_called_with([rpm_path])
finally:
os.remove(rpm_path)

Expand Down

0 comments on commit c2965d8

Please sign in to comment.