Commit 0514bb95 by jiaqiying

修复冲突

parents 3cdc4811 bb089ca2
import xlrd,re,json
"""调试中不可用"""
workBook = xlrd.open_workbook('../data/营运车接口测试用例V1.0.xls')
# 可以自动识别用例数
def get_excelData(sheetName,caseName):
def get_excelData(workBook,sheetName,caseName):
"""
:param sheetName: sheet表名
:param caseName: 从excle中第一列关键字(字母)
......@@ -28,13 +24,16 @@ def get_excelData(sheetName,caseName):
dict0['url'] = workSheet.cell_value(idx, num_url)
dict0['headers'] = workSheet.cell_value(idx, num_headers)
dict0['method'] = workSheet.cell_value(idx, num_method)
dict0['data'] = workSheet.cell_value(idx, num_reqData)
dict0['expected'] = workSheet.cell_value(idx, num_expectData)
dict0['reqData'] = workSheet.cell_value(idx, num_reqData)
dict0['expectData'] = workSheet.cell_value(idx, num_expectData)
# json字符串转换成字典
dict0['reqData'] = json.loads(dict0['reqData'])
dict0['expectData'] = json.loads(dict0['expectData'])
dict0['headers'] = json.loads(dict0['expectData'])
try:
dict0['headers'] = json.loads(dict0['headers'])
except:
print('header无')
lis.append(dict0)
idx += 1
......@@ -44,3 +43,9 @@ def get_excelData(sheetName,caseName):
except:
print("检查excle中标题是否正确")
if __name__ == '__main__':
workBook = xlrd.open_workbook('../../test_case_data/bmy_case.xlsx')
li = get_excelData(workBook,"登录模块","Login")
print(li)
......@@ -14,13 +14,11 @@ class BMCConfig(BaseConfig):
# 测试用例目录
name = "bmc"
test_case_dir = "test_case/bmc/"
class DingTalk(BaseConfig):
"""钉钉机器人"""
webhook = ''
salt = 'hikcreate_xj'
class SSOLoginConfig(BaseConfig):
"""登录配置"""
salt = 'hikcreate_xj'
\ No newline at end of file
class BMCConfig(BaseConfig):
"""斑马信用app的配置类11"""
pass
......@@ -30,5 +30,5 @@ six==1.15.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3
toml==0.10.2; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
typing-extensions==3.7.4.3; python_version < '3.8'
urllib3==1.25.11; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'
xlrd==2.0.0
xlrd==1.2.0
zipp==3.4.1; python_version >= '3.6'
import pytest
import requests
from config import BaseConfig
from common.utils.encryption import Encryption
# from common.utils.getExcelData import get_excelData
from common.tools import request_main
@pytest.fixture(scope='session')
def sso_login(url, headers, method, data):
"""SSO登录"""
req_data = {"loginName":"fanxun","password":"fx123456"}
password = req_data['password']
md5_password = Encryption().get_md5(password, salt=BaseConfig.salt)
req_data['password'] = md5_password
res = request_main(url, headers, method, req_data)
print(res)
def sso_login():
"""sso登录"""
pass
def bmy_login():
"""企业云登录"""
"""kkkk"""
pass
if __name__ == '__main__':
# login = request_main(url=r'http://testtbdzj.hikcreate.com/web/auth/users/login',
# method='post',
# data={"loginName":"fanxun","password":"d67fac1d71943576b6c397d0cca166cb"},
# headers=getattr(BaseConfig, 'headers'))
sso_login(r'http://testtbdzj.hikcreate.com/web/auth/users/login',
headers=getattr(BaseConfig, 'headers'),
method='post',
data=None)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment