示例#1
0
文件: test_yumdb.py 项目: lmacken/dnf
 def test_instantiate(self, mock_exists):
     yumbase = support.MockYumBase()
     path = yumbase.conf.persistdir + '/yumdb'
     pkgdb = dnf.yum.rpmsack.AdditionalPkgDB(path)
     pkg = installed_by_name(yumbase.sack, "pepper")[0]
     directory = pkgdb._get_dir_name(pkg.pkgtup, pkg.pkgid)
     self.assertEqual("%s/yumdb/p/<nopkgid>-pepper-20-0-x86_64" %
                      yumbase.conf.persistdir,
                      directory)
示例#2
0
    def pkgtup2pid_test(self):
        """ Check pkg2pid() correctly delegates to _*2pid()s. """
        hpkg = dnf.yum.history.YumHistoryPackage("n", "a", "e", "v", "r")
        with mock.patch.object(self.history, "_hpkg2pid") as hpkg2pid:
            self.history.pkg2pid(hpkg)
            hpkg2pid.assert_called_with(hpkg, True)

        ipkg = installed_by_name(self.sack, "pepper")[0]
        with mock.patch.object(self.history, "_ipkg2pid") as ipkg2pid:
            self.history.pkg2pid(ipkg)
            ipkg2pid.assert_called_with(ipkg, True)

        apkg = available_by_name(self.sack, "lotus")[0]
        with mock.patch.object(self.history, "_apkg2pid") as apkg2pid:
            self.history.pkg2pid(apkg)
            apkg2pid.assert_called_with(apkg, True)