def test_config():
    pc = PathConfig(root_envi, ROOT_CONFIG_DIR)
    x = pc.get_all_platform_data_roots()
    assert pc.is_site_configuration()
    assert 'primary' in x
    assert 'secondary' in x
    x = template.read_templates(pc)

    assert x

    apackdir = os.path.join(root_envi,BaseEnv.envi_iddir(),BaseEnv.pack_tag())
    aconfdir = os.path.join(root_envi,BaseEnv.envi_iddir(),BaseEnv.config_tag())
    envi_info = os.path.join(os.environ.get('DSKENVPATH'), 'configs_and_packs/envi_info.yml')
    bad_envi_info = '/mnt1/dev/dsk_configuration/envi/configs_and_packs/envi_info.yml'
    #d = {'Config': root_envi}
    d = {'Config': ('envi'),'name' : ('info')}
    a = x["envi_info"].apply_fields(d)
    assert a == envi_info
    a = x["envi_info"].missing_keys({}) 

    assert set(a) == set(d.keys())
    assert aconfdir ==  x["config_path"].apply_fields(d)

    assert apackdir ==  x["pack_path"].apply_fields(d)

    assert x['envi_info'].validate_and_get_fields(bad_envi_info)  == None
示例#2
0
 def reset(self, envplace=""):
     """overwrite the class instance file_location
         :param envplace: path (str) to the envi location
         :return None:
     """
     if envplace != "":
         EnviApi.__file_location = os.path.join(envplace,
                                                BaseEnv.envi_iddir(),
                                                BaseEnv.envi_file_name())
     self.dev_user = list()