from jsonpath_rw import jsonpath, parse from utils import readYaml from utils import jsonRead from utils import jsonAnalysis from utils import mongoDataOpr from utils import httpApi testerName = 'sunxiaojian' controllerName = "RedirectPoliciesController" interfaceChName = "Web重定向策略管理" interfaceEnName = "addwebRedirectPolicies" commonConfig = readYaml.get_config("common/config.yaml", "common") # 返回config.yaml文件中的common数组的所有数据 authenticationApiPaths = readYaml.get_apiPath( "common/apiPaths/authenticationPath.yaml" ) # 返回linkidPath.yaml文件中的所有linkid接口路径 urlIP = commonConfig[0]["linkidIP"] urlPath = authenticationApiPaths[0]['addwebRedirectPolicies'] dirPath, fileName = os.path.split(os.path.abspath(__file__)) cases_main, parameters_main = jsonRead.loadHttpData(dirPath + "/testData.json", 'mainCaseData') # 读取测试数据 cases_all, parameters_all = jsonRead.loadHttpData(dirPath + "/testData.json", 'allCaseData') dbJsonPath = dirPath + "/dbData.json" dbName = "authentication" @allure.epic(controllerName) @allure.feature(interfaceChName)
import os import sys o_path = os.getcwd() #返回当前工作目录 sys.path.append(o_path) #添加自己指定的搜索路径 from utils import readYaml linkidApiPaths = readYaml.get_apiPath("../common/apiPaths/linkidPath.yaml") ssoApiPaths = readYaml.get_apiPath("../common/apiPaths/ssoPath.yaml") authenticationApiPaths = readYaml.get_apiPath("../common/apiPaths/authenticationPath.yaml") def getJsonKeyValue(data): dataKey = [] dataValue = [] if isinstance(data, dict): for key in data: dataKey.append(key) dataValue.append(data[key]) return dataValue linkidPas = getJsonKeyValue(linkidApiPaths[0]) ssoPas = getJsonKeyValue(ssoApiPaths[0]) authenticationPas = getJsonKeyValue(authenticationApiPaths[0]) print(linkidPas, '\n -------以上是linkid所有api的path,以下是sso的所有api的path \n',ssoPas,authenticationPas)
from jsonpath_rw import jsonpath, parse from utils import readYaml from utils import jsonRead from utils import jsonAnalysis from utils import mongoDataOpr from utils import httpApi from utils import checkConnect testerName = 'yangxi' controllerName = "AggregateUserController" interfaceChName = "删除教职工接口" interfaceEnName = "aggregateDeleteUser" commonConfig = readYaml.get_config("common/config.yaml", "common") #返回config.yaml文件中的common数组的所有数据 linkidApiPaths = readYaml.get_apiPath( "common/apiPaths/linkidPath.yaml") #返回linkidPath.yaml文件中的所有linkid接口路径 urlIP = commonConfig[0]["linkidIP"] #获取接口IP urlPath = linkidApiPaths[0]['aggregateDeleteUser'] #获取接口path dirPath, fileName = os.path.split(os.path.abspath(__file__)) cases_main, parameters_main = jsonRead.loadHttpData(dirPath + "/testData.json", 'mainCaseData') #读取主流程测试数据 cases_all, parameters_all = jsonRead.loadHttpData(dirPath + "/testData.json", 'allCaseData') #读取所有测试数据 dbJsonPath = dirPath + "/dbData.json" #获取数据库设计数据 dbName = "linkid" #数据库设计中对应的组件 def setup_module(): if checkConnect.checkConnection(urlIP) == 'error':
from utils import readConfig from utils import readYaml from utils import jsonRead from utils import zt_linkidApi from utils import jsonAnalysis from utils import mongoDataOpr from utils import httpApi from utils import checkConnect testerName = 'yangxi' controllerName = "ztApiOrganizationController" interfaceChName = "批量查询组织" interfaceEnName = "batchGetOrg" commonConfig = readYaml.get_config("common/config.yaml", "common") linkidApiPaths = readYaml.get_apiPath("common/apiPaths/linkidPath.yaml") ssoApiPaths = readYaml.get_apiPath("common/apiPaths/ssoPath.yaml") tokenJ = zt_linkidApi.accessToken(commonConfig[0]['sid'], ssoApiPaths[0]['tokenPath'], commonConfig[0]['appId'], commonConfig[0]['appSecret']) urlIP = commonConfig[0]["sidself"] urlPath = linkidApiPaths[0]['publicZtOrgGetPath'] dirPath, fileName = os.path.split(os.path.abspath(__file__)) cases_main, parameters_main = jsonRead.loadHttpData(dirPath + "/testData.json", 'mainCaseData') cases_all, parameters_all = jsonRead.loadHttpData(dirPath + "/testData.json", 'allCaseData') dbJsonPath = dirPath + "/dbData.json" dbName = "linkid"