Example #1
0
def getid():
    """数据库id生成器,每次使用后+1"""
    wd = WriteFileData()
    datass = ReadFileData()
    ini_path = os.path.join(path_conf.BASE_DIR, "config", "setting.ini")
    ini_data = datass.load_ini(ini_path)
    sqlid_start = ini_data['other']['sql_id']
    sqlid_end = int(sqlid_start) + 1
    data_file_path = os.path.join(path_conf.INI_PATH, 'setting.ini')
    wd.write_ini(data_file_path, 'other', 'sql_id', str(sqlid_end))
    return sqlid_start
Example #2
0
def convert_json_to_yaml(origin_json, yaml_path, mainkey):
    """
    json返回值写入yaml文件expectresult下
    :param mainkey:
    :param origin_json:
    :param yaml_path:
    :return:
    """
    wd = WriteFileData()
    dyaml = yaml.load(origin_json, Loader=yaml.FullLoader)  # 将字符转yaml
    wd.write_yaml(yaml_path, mainkey, 'expectresult', dyaml)
    logger.info(">>> json转换yaml完成,转换数据:%s" % origin_json)
Example #3
0
# coding:utf-8

import json
import allure
import pytest
from common import path_conf
from core import result_base
from common import get_root_url
from core.rest_client import RestClient
from common.write_data import WriteFileData
from common.convert import convert_json_to_yaml
from core.common_params import get_common_params
from core.checkresult import check_codes_msg, check_datas

reportpath = path_conf.REPORT_PATH
wd = WriteFileData()
result = result_base.ResultBase()
rooturl = get_root_url.get_root_urls()
a = RestClient(rooturl)


@pytest.mark.usefixtures('is_login')
@pytest.mark.usefixtures('insert_module_data')
@allure.feature("模块数据详细")
class TestModuleDataDetails(object):
    @allure.story("字段排序查询")
    def test01(self):
        """字段排序查询"""
        csurl, method, head, yamlvalue, yaml_path, mainkey = get_common_params(
            "module_data_details.yaml", "字段排序查询")
        r = a.request(csurl, method, headers=head)