Ejemplo n.º 1
0
 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' % tests.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)
Ejemplo n.º 2
0
 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' % tests.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)
Ejemplo n.º 3
0
    def test_inheritance2(self):
        conf = Conf()

        # if repoconf reads value from config it no more inherits changes from conf
        conf.config_file_path = tests.support.resource_path('etc/repos.conf')
        with mock.patch('logging.Logger.warning'):
            reader = dnf.conf.read.RepoReader(conf, {})
            repo = list(reader)[0]

        self.assertEqual(conf.minrate, 1000)
        self.assertEqual(repo.minrate, 4096)

        # after global change
        conf.minrate = 2000
        self.assertEqual(conf.minrate, 2000)
        self.assertEqual(repo.minrate, 4096)
Ejemplo n.º 4
0
    def test_inheritance2(self):
        conf = Conf()

        # if repoconf reads value from config it no more inherits changes from conf
        conf.config_file_path = tests.support.resource_path('etc/repos.conf')
        with mock.patch('logging.Logger.warning'):
            reader = dnf.conf.read.RepoReader(conf, {})
            repo = list(reader)[0]

        self.assertEqual(conf.minrate, 1000)
        self.assertEqual(repo.minrate, 4096)

        # after global change
        conf.minrate = 2000
        self.assertEqual(conf.minrate, 2000)
        self.assertEqual(repo.minrate, 4096)
Ejemplo n.º 5
0
    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)
Ejemplo n.º 6
0
    def test_order_insensitive(self):
        conf = Conf()
        conf.config_file_path = '%s/etc/dnf/dnf.conf' % tests.support.dnf_toplevel(
        )
        opts = argparse.Namespace(gpgcheck=False,
                                  main_setopts={'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)