def test_installroot_with_etc(self): """Test that conffile is detected in a new installroot.""" self.cli.base.extcmds = [] tlv = support.dnf_toplevel() self.cli.configure(['--installroot', tlv, 'update']) self.assertEqual(self.base.conf.config_file_path, '%s/etc/dnf/dnf.conf' % tlv)
def test_installroot_configurable(self): """Test that conffile is detected in a new installroot.""" self.cli.base.basecmd = "update" conf = os.path.join(support.dnf_toplevel(), "tests/etc/installroot.conf") self.cli.configure(["-c", conf, "--releasever", "17", "update"]) self.assertEqual(self.base.conf.installroot, "/roots/dnf")
def test_installroot_configurable(self): """Test that conffile is detected in a new installroot.""" self.cli.base.basecmd = 'update' conf = os.path.join(support.dnf_toplevel(), "tests/etc/installroot.conf") self.cli.configure(['-c', conf, '--releasever', '17', 'update']) self.assertEqual(self.base.conf.installroot, '/roots/dnf')
def setUp(self): self.base = support.MockBase("main") self.base._conf = dnf.conf.Conf() self.base.output = support.MockOutput() self.base.plugins = mock.Mock() self.cli = dnf.cli.cli.Cli(self.base) self.cli.command = mock.Mock() self.conffile = os.path.join(support.dnf_toplevel(), "etc/dnf/dnf.conf")
def setUp(self): self.base = support.MockBase("main") self.base._conf = dnf.conf.Conf() self.base.output = support.MockOutput() self.base._plugins = mock.Mock() self.cli = dnf.cli.cli.Cli(self.base) self.cli.command = mock.Mock() self.conffile = os.path.join(support.dnf_toplevel(), "etc/dnf/dnf.conf")
def test_installroot_configurable(self): """Test that conffile is detected in a new installroot.""" conf = os.path.join(support.dnf_toplevel(), "tests/etc/installroot.conf") self.cli.configure( ['-c', conf, '--nogpgcheck', '--releasever', '17', 'update']) self.assertEqual(self.base.conf.installroot, '/roots/dnf')
def test_installroot_with_etc(self, read_conf_file): """Test that conffile is detected in a new installroot.""" self.cli.base.basecmd = 'update' tlv = support.dnf_toplevel() self.cli.configure(['--installroot', tlv, 'update']) read_conf_file.assert_called_with( '%s/etc/dnf/dnf.conf' % tlv, tlv, None, {'conffile': '%s/etc/dnf/dnf.conf' % tlv, 'installroot': tlv})
def test_installroot_with_etc(self, read_conf_file): """Test that conffile is detected in a new installroot.""" self.cli.base.basecmd = "update" self.cli.base.extcmds = [] tlv = support.dnf_toplevel() self.cli.configure(["--installroot", tlv, "update"]) read_conf_file.assert_called_with( "%s/etc/dnf/dnf.conf" % tlv, tlv, None, {"conffile": "%s/etc/dnf/dnf.conf" % tlv, "installroot": tlv} )
def test_conf_from_file(self): conf = Conf() # defaults self.assertFalse(conf.gpgcheck) self.assertEqual(conf.installonly_limit, 3) self.assertTrue(conf.clean_requirements_on_remove) conf.config_file_path = '%s/etc/dnf/dnf.conf' % support.dnf_toplevel() conf.read(priority=dnf.conf.PRIO_MAINCONFIG) self.assertTrue(conf.gpgcheck) self.assertEqual(conf.installonly_limit, 3) self.assertTrue(conf.clean_requirements_on_remove)
def test_conf_from_file(self): conf = Conf() # defaults self.assertFalse(conf.gpgcheck) self.assertEqual(conf.installonly_limit, 0) self.assertTrue(conf.clean_requirements_on_remove) conf.config_file_path = '%s/etc/dnf/dnf.conf' % support.dnf_toplevel() conf.read(priority=dnf.conf.PRIO_MAINCONFIG) self.assertTrue(conf.gpgcheck) self.assertEqual(conf.installonly_limit, 3) self.assertTrue(conf.clean_requirements_on_remove)
def test_installroot_with_etc(self, read_conf_file): """Test that conffile is detected in a new installroot.""" self.cli.base.basecmd = 'update' self.cli.base.extcmds = [] tlv = support.dnf_toplevel() self.cli.configure(['--installroot', tlv, 'update']) read_conf_file.assert_called_with( '%s/etc/dnf/dnf.conf' % tlv, tlv, None, { 'conffile': '%s/etc/dnf/dnf.conf' % tlv, 'installroot': tlv })
def test_order_insensitive(self): conf = Conf() conf.config_file_path = '%s/etc/dnf/dnf.conf' % support.dnf_toplevel() opts = argparse.Namespace(gpgcheck=False, main_setopts=argparse.Namespace(installonly_limit=5)) # read config conf.read(priority=dnf.conf.PRIO_MAINCONFIG) # update from commandline conf._configure_from_options(opts) self.assertFalse(conf.gpgcheck) self.assertEqual(conf.installonly_limit, 5) # and the other way round should have the same result # update from commandline conf._configure_from_options(opts) # read config conf.read(priority=dnf.conf.PRIO_MAINCONFIG) self.assertFalse(conf.gpgcheck) self.assertEqual(conf.installonly_limit, 5)
def test_order_insensitive(self): conf = Conf() conf.config_file_path = '%s/etc/dnf/dnf.conf' % support.dnf_toplevel() opts = argparse.Namespace( gpgcheck=False, main_setopts=argparse.Namespace(installonly_limit=5)) # read config conf.read(priority=dnf.conf.PRIO_MAINCONFIG) # update from commandline conf._configure_from_options(opts) self.assertFalse(conf.gpgcheck) self.assertEqual(conf.installonly_limit, 5) # and the other way round should have the same result # update from commandline conf._configure_from_options(opts) # read config conf.read(priority=dnf.conf.PRIO_MAINCONFIG) self.assertFalse(conf.gpgcheck) self.assertEqual(conf.installonly_limit, 5)
def setUp(self): self.yumbase = support.MockYumBase("main") self.cli = dnf.cli.cli.Cli(self.yumbase) self.conffile = os.path.join(support.dnf_toplevel(), "etc/dnf/dnf.conf")
from tests.support import mock import dnf.callback import dnf.drpm import dnf.repo import dnf.util import dnf.exceptions import iniparse.compat import io import librepo import os import re import tempfile import unittest REPOS = "%s/tests/repos" % support.dnf_toplevel() BASEURL = "file://%s/rpm" % REPOS TOUR_CHKSUM = """\ ce77c1e5694b037b6687cf0ab812ca60431ec0b65116abbb7b82684f0b092d62""" class RepoFunctionsTest(unittest.TestCase): def test_cachedir_re(self): pairs = [ ('fedora-fe3d2f0c91e9b65c', 'fedora'), ('foo-bar-eb0d6f10ccbdafba', 'foo-bar'), ('a%^&$b-fe3d2f0c91e9b65c', None), ('fedora-91e9b65c', None), ('fedora-xe3d2f0c91e9b65c', None), ('-fe3d2f0c91e9b65c', None), ('fedorafe3d2f0c91e9b65c', None),
def test_toplevel(self): self.assertIn(support.dnf_toplevel(), sys.path)