示例#1
0
 def test_repoid_option(self):
     args = ["--repo", "main"]
     self.cmd.base.repos.add(support.RepoStub("main"))
     self.cmd.base.repos.add(support.RepoStub("main_fail"))
     support.command_configure(self.cmd, args)
     repos = [repo.id for repo in self.cmd.base.repos.iter_enabled()]
     self.assertEqual(["main"], repos)
 def test_check_option(self):
     args = ["--check", "@commandline"]
     self.cmd.base.repos.add(support.RepoStub("main"))
     self.cmd.base.add_remote_rpms([os.path.join(self.path, "noarch/foo-4-6.noarch.rpm")])
     with mock.patch("sys.stdout", new_callable=dnf.pycomp.StringIO) as stdout:
         support.command_run(self.cmd, args)
         expected_out = ["package: foo-4-6.noarch from @commandline",
                         "  unresolved deps:",
                         "    bar = 4-6"]
         self.assertEqual(stdout.getvalue()[:-1], "\n".join(expected_out))
     args = ["--check", "main"]
     with mock.patch("sys.stdout", new_callable=dnf.pycomp.StringIO) as stdout:
         support.command_run(self.cmd, args)
         self.assertEmpty(stdout.getvalue())
示例#3
0
    def test_pkg_download_path(self):
        args = '-p /become/legend'.split()
        repo = support.RepoStub('silver')
        support.command_configure(self.cmd, args)
        pkg = support.PkgStub('foo',
                              '0',
                              '1.0',
                              '1',
                              'noarch',
                              'silver',
                              repo=repo,
                              location="foo-0-1.0-1.noarch.rpm")

        pkgpath = self.cmd.pkg_download_path(pkg)
        self.assertEqual(pkgpath,
                         '/become/legend/silver/foo-0-1.0-1.noarch.rpm')

        pkg.location = "../pool/foo-0-1.0-1.noarch.rpm"
        with self.assertRaises(dnf.exceptions.Error):
            self.cmd.pkg_download_path(pkg)
示例#4
0
 def test_metadata_target_given(self):
     args = '-p /become/legend --metadata-path=/the/president'.split()
     repo = support.RepoStub('silver')
     support.command_configure(self.cmd, args)
     metadata_path = self.cmd.metadata_target(repo)
     self.assertEqual(metadata_path, '/the/president/silver')
示例#5
0
 def test_metadata_target_default(self):
     args = '-p /become/legend'.split()
     repo = support.RepoStub('silver')
     support.command_configure(self.cmd, args)
     metadata_path = self.cmd.metadata_target(repo)
     self.assertEqual(metadata_path, '/become/legend/silver')