Esempio n. 1
0
    def test_file_add_remove(self):
        self.assertIn(self.config_1_name, config._config_files)
        self.assertIn(self.config_2_name, config._config_files)
        self.assertIn('section1', config.config.sections())
        self.assertIn('section2', config.config.sections())

        # remove a config, make sure the other one's still loaded
        config.remove_config_file(self.config_2_name)
        self.assertIn('section1', config.config.sections())
        self.assertNotIn('section2', config.config.sections())

        # remove both, make sure neither is loaded
        config.remove_config_file(self.config_1_name)
        self.assertNotIn('section1', config.config.sections())
        self.assertNotIn('section2', config.config.sections())

        # add a config back, make sure the other still isn't loaded
        config.add_config_file(self.config_1_name)
        self.assertIn('section1', config.config.sections())
        self.assertNotIn('section2', config.config.sections())

        # add the other config back, everything should be loaded again
        config.add_config_file(self.config_2_name)
        self.assertIn('section1', config.config.sections())
        self.assertIn('section2', config.config.sections())
Esempio n. 2
0
    def test_file_add_remove(self):
        self.assertIn(self.config_1_name, config._config_files)
        self.assertIn(self.config_2_name, config._config_files)
        self.assertIn('section1', config.config.sections())
        self.assertIn('section2', config.config.sections())

        # remove a config, make sure the other one's still loaded
        config.remove_config_file(self.config_2_name)
        self.assertIn('section1', config.config.sections())
        self.assertNotIn('section2', config.config.sections())

        # remove both, make sure neither is loaded
        config.remove_config_file(self.config_1_name)
        self.assertNotIn('section1', config.config.sections())
        self.assertNotIn('section2', config.config.sections())

        # add a config back, make sure the other still isn't loaded
        config.add_config_file(self.config_1_name)
        self.assertIn('section1', config.config.sections())
        self.assertNotIn('section2', config.config.sections())

        # add the other config back, everything should be loaded again
        config.add_config_file(self.config_2_name)
        self.assertIn('section1', config.config.sections())
        self.assertIn('section2', config.config.sections())
Esempio n. 3
0
def load_test_config():
    if not os.path.exists('/tmp/pulp'):
        os.makedirs('/tmp/pulp')

    override_file = os.path.join(DATA_DIR, 'test-override-pulp.conf')
    stop_logging()
    try:
        config.add_config_file(override_file)
    except RuntimeError:
        pass
    start_logging()

    return config.config
Esempio n. 4
0
File: base.py Progetto: ipanova/pulp
def load_test_config():
    if not os.path.exists('/tmp/pulp'):
        os.makedirs('/tmp/pulp')

    override_file = os.path.join(DATA_DIR, 'test-override-pulp.conf')
    stop_logging()
    try:
        config.add_config_file(override_file)
    except RuntimeError:
        pass
    start_logging()

    return config.config
Esempio n. 5
0
File: base.py Progetto: ehelms/pulp
def load_test_config():
    if not os.path.exists('/tmp/pulp'):
        os.makedirs('/tmp/pulp')

    override_file = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data', 'test-override-pulp.conf')
    override_repo_file = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data', 'test-override-repoauth.conf')
    stop_logging()
    try:
        config.add_config_file(override_file)
        config.add_config_file(override_repo_file)
    except RuntimeError:
        pass
    start_logging()

    return config.config
Esempio n. 6
0
def load_test_config():
    if not os.path.exists('/tmp/pulp'):
        os.makedirs('/tmp/pulp')

    override_file = os.path.join(os.path.abspath(os.path.dirname(__file__)), '../data', 'test-override-pulp.conf')
    override_repo_file = os.path.join(os.path.abspath(os.path.dirname(__file__)), '../data', 'test-override-repoauth.conf')
    stop_logging()
    try:
        config.add_config_file(override_file)
        config.add_config_file(override_repo_file)
    except RuntimeError:
        pass
    start_logging()

    return config.config
Esempio n. 7
0
    def test_file_add_remove_existing(self):
        self.assertIn(self.config_1_name, config._config_files)

        # add a file that's already in the config files list
        with self.assertRaises(RuntimeError) as cm:
            config.add_config_file(self.config_1_name)
        self.assertIn(self.config_1_name, cm.exception.args[0])
        self.assertIn('already in configuration files', cm.exception.args[0])

        # remove a file that isn't in the config files list
        config.remove_config_file(self.config_1_name)
        self.assertNotIn(self.config_1_name, config._config_files)

        with self.assertRaises(RuntimeError) as cm:
            config.remove_config_file(self.config_1_name)
        self.assertIn(self.config_1_name, cm.exception.args[0])
        self.assertIn('not in configuration files', cm.exception.args[0])
Esempio n. 8
0
    def test_file_add_remove_existing(self):
        self.assertIn(self.config_1_name, config._config_files)

        # add a file that's already in the config files list
        with self.assertRaises(RuntimeError) as cm:
            config.add_config_file(self.config_1_name)
        self.assertIn(self.config_1_name, cm.exception.args[0])
        self.assertIn('already in configuration files', cm.exception.args[0])

        # remove a file that isn't in the config files list
        config.remove_config_file(self.config_1_name)
        self.assertNotIn(self.config_1_name, config._config_files)

        with self.assertRaises(RuntimeError) as cm:
            config.remove_config_file(self.config_1_name)
        self.assertIn(self.config_1_name, cm.exception.args[0])
        self.assertIn('not in configuration files', cm.exception.args[0])