Exemple #1
0
    def test_load_config_object(self, tmpdir):
        '''load config object from file, make sure it's loaded properly'''

        refdir = tmpdir.mkdir('conf')
        ref_conf_filename = '{}/{}'.format(refdir, config.CONF_FILE)
        with open(ref_conf_filename, 'w+') as ref_conffile:
            ref_conffile.write(REF_CONF_CONTENTS)

        test_config = config._load_config(ref_conf_filename)

        assert test_config.DATA_DIR == REF_DATA_DIR
Exemple #2
0
    def test_load_config_object(self, tmpdir):
        '''load config object from file, make sure it's loaded properly'''

        refdir = tmpdir.mkdir('conf')
        ref_conf_filename = '{}/{}'.format(refdir, config.CONF_FILE)
        with open(ref_conf_filename, 'w+') as ref_conffile:
            ref_conffile.write(REF_CONF_CONTENTS)

        test_config = config._load_config(ref_conf_filename)

        assert test_config.DATA_DIR == REF_DATA_DIR
Exemple #3
0
    def test_merge_config_file(self, tmpdir):
        '''merge loaded config object with defaults, make sure that the defaults
        are overridden.
        '''

        refdir = tmpdir.mkdir('conf')
        ref_conf_filename = '{}/{}'.format(refdir, config.CONF_FILE)
        with open(ref_conf_filename, 'w+') as ref_conffile:
            ref_conffile.write(REF_CONF_CONTENTS)

        test_config_obj = config._load_config(ref_conf_filename)

        test_config = config.ConfigData()
        assert test_config.DATA_DIR != REF_DATA_DIR

        test_config.merge_object(test_config_obj)
        assert test_config.DATA_DIR == REF_DATA_DIR
Exemple #4
0
    def test_merge_config_file(self, tmpdir):
        '''merge loaded config object with defaults, make sure that the defaults
        are overridden.
        '''

        refdir = tmpdir.mkdir('conf')
        ref_conf_filename = '{}/{}'.format(refdir, config.CONF_FILE)
        with open(ref_conf_filename, 'w+') as ref_conffile:
            ref_conffile.write(REF_CONF_CONTENTS)

        test_config_obj = config._load_config(ref_conf_filename)

        test_config = config.ConfigData()
        assert test_config.DATA_DIR != REF_DATA_DIR

        test_config.merge_object(test_config_obj)
        assert test_config.DATA_DIR == REF_DATA_DIR