import os
from Aops_Api_Auto_Test.utils.YamlUtil import Yaml
current = os.path.abspath(__file__)
BASE_DIR = os.path.dirname(os.path.dirname(current))
_config_path = BASE_DIR + os.sep + "config"
_data_path = BASE_DIR + os.sep + "test_data"
_config_file = _config_path + os.sep + "conf.yaml"
_log_path = BASE_DIR + os.sep + "logs"
_report_path = BASE_DIR + os.sep + "report"
_common_yaml_path = BASE_DIR + os.sep + "test_data" + "/" + "common.yaml"
def get_config_path():
return _config_path
def get_config_file():
return _config_file
def get_log_path():
return _log_path
def get_data_path():
return _data_path
def get_report_path():
return _report_path
def get_common_yaml_path():
return _common_yaml_path
class ConfigYaml:
def __init__(self):
self.config = Yaml(get_config_file()).data()
def get_conf_url(self):
"""
获取测试的服务的配置信息
:return:
"""
return self.config["BASE"]["test"]["url"]
def get_user(self):
"""
获取用户名
:return:
"""
return self.config["BASE"]["test"]["username"]
def get_login_password(self):
"""
获取登录密码
:return:
"""
return self.config["BASE"]["test"]["password"]
def get_repo_data(self):
"""
获取repo
:return:
"""
return self.config["repo"]["repo_data"]
def get_conf_log(self):
return self.config["BASE"]["log_level"]
def get_conf_log_extension(self):
return self.config["BASE"]["log_extension"]
def get_db_config_info(self):
return self.config['db']
def get_host_info(self):
return self.config['host']