예제 #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')
예제 #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')
예제 #3
0
파일: test_config.py 프로젝트: edynox/dnf
    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)
예제 #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)