Ejemplo n.º 1
0
    def test_overrides(self):
        conf = Conf()
        self.assertFalse(conf.assumeyes)
        self.assertFalse(conf.assumeno)
        self.assertEqual(conf.color, 'auto')

        opts = argparse.Namespace(assumeyes=True, color='never')
        conf._configure_from_options(opts)
        self.assertTrue(conf.assumeyes)
        self.assertFalse(conf.assumeno)  # no change
        self.assertEqual(conf.color, 'never')
Ejemplo n.º 2
0
    def test_overrides(self):
        conf = Conf()
        self.assertFalse(conf.assumeyes)
        self.assertFalse(conf.assumeno)
        self.assertEqual(conf.color, 'auto')

        opts = argparse.Namespace(assumeyes=True, color='never')
        conf._configure_from_options(opts)
        self.assertTrue(conf.assumeyes)
        self.assertFalse(conf.assumeno)  # no change
        self.assertEqual(conf.color, 'never')
Ejemplo n.º 3
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.º 4
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)