Пример #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())
Пример #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())
Пример #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
Пример #4
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
Пример #5
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
Пример #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
Пример #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])
Пример #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])