コード例 #1
0
 def __init__(self, yaml_file):
     yaml_dict = utils.load_yaml(yaml_file)
     if isinstance(yaml_dict, dict):
         for section, sec_body in yaml_dict.items():
             self[section] = {}
             if isinstance(sec_body, dict):
                 for obj_name, obj_body in sec_body.items():
                     self[section][obj_name] = _build_mock_object(obj_body)
コード例 #2
0
ファイル: res_mock.py プロジェクト: openstack/manila
 def __init__(self, yaml_file):
     yaml_dict = utils.load_yaml(yaml_file)
     if isinstance(yaml_dict, dict):
         for section, sec_body in yaml_dict.items():
             self[section] = {}
             if isinstance(sec_body, dict):
                 for obj_name, obj_body in sec_body.items():
                     self[section][obj_name] = _build_mock_object(obj_body)
コード例 #3
0
 def __init__(self, yaml_file):
     yaml_dict = utils.load_yaml(yaml_file)
     if isinstance(yaml_dict, dict):
         for name, body in yaml_dict.items():
             if isinstance(body, dict):
                 props = body[SYMBOL_PROPERTIES]
                 if isinstance(props, dict):
                     for prop_name, prop_value in props.items():
                         if isinstance(prop_value, dict) and prop_value:
                             # get the first key as the convert function
                             func_name = list(prop_value.keys())[0]
                             if func_name.startswith('_'):
                                 func = getattr(self, func_name)
                                 props[prop_name] = (func(
                                     **prop_value[func_name]))
                 if body[SYMBOL_TYPE] in self.fake_func_mapping:
                     self[name] = (
                         self.fake_func_mapping[body[SYMBOL_TYPE]](**props))
コード例 #4
0
ファイル: res_mock.py プロジェクト: openstack/manila
 def __init__(self, yaml_file):
     yaml_dict = utils.load_yaml(yaml_file)
     if isinstance(yaml_dict, dict):
         for name, body in yaml_dict.items():
             if isinstance(body, dict):
                 props = body[SYMBOL_PROPERTIES]
                 if isinstance(props, dict):
                     for prop_name, prop_value in props.items():
                         if isinstance(prop_value, dict) and prop_value:
                             # get the first key as the convert function
                             func_name = list(prop_value.keys())[0]
                             if func_name.startswith('_'):
                                 func = getattr(self, func_name)
                                 props[prop_name] = (
                                     func(**prop_value[func_name]))
                 if body[SYMBOL_TYPE] in self.fake_func_mapping:
                     self[name] = (
                         self.fake_func_mapping[body[SYMBOL_TYPE]](**props))