mirror of https://gitee.com/a529548204/apitest.git
fixbug
This commit is contained in:
parent
2f2d8a3c44
commit
7cd7a6117b
|
@ -2,7 +2,7 @@ venv
|
|||
.idea
|
||||
__pycache__/
|
||||
logs/
|
||||
./report/
|
||||
/report/
|
||||
.pytest_cache/
|
||||
config/config.ini
|
||||
caches
|
|
@ -55,8 +55,8 @@ class apiSend(object):
|
|||
allure.attach(name="请求地址", body=url)
|
||||
allure.attach(name="请求头", body=str(header))
|
||||
allure.attach(name="请求参数", body=str(data_random))
|
||||
if "multipart/form-data" in header.values():
|
||||
if files is not None:
|
||||
if "multipart/form-data" in str(header.values()):
|
||||
if isinstance(files,dict):
|
||||
for i in files:
|
||||
value = files[i]
|
||||
if isinstance(value, int):
|
||||
|
@ -72,11 +72,13 @@ class apiSend(object):
|
|||
boundary='-----------------------------' + str(random.randint(int(1e28), int(1e29 - 1)))
|
||||
)
|
||||
header['Content-Type'] = multipart.content_type
|
||||
response = requests.post(url=url, data=data, headers=header, timeout=timeout)
|
||||
else:
|
||||
response = requests.post(url=url, headers=header, timeout=timeout,data=multipart)
|
||||
elif files is None:
|
||||
multipart = MultipartEncoder(data)
|
||||
response = requests.post(url=url, data=multipart, headers={'Content-Type': multipart.content_type},
|
||||
timeout=timeout)
|
||||
else:
|
||||
raise TypeError("files参数格式错误")
|
||||
elif 'application/json' in header.values():
|
||||
if data_random:
|
||||
data_random = json.loads(data_random)
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
allure-pytest==2.9.43
|
||||
allure-python-commons==2.9.43
|
||||
atomicwrites==1.4.0
|
||||
attrs==21.2.0
|
||||
certifi==2021.5.30
|
||||
chardet==4.0.0
|
||||
colorama==0.4.4
|
||||
coverage==5.5
|
||||
DingtalkChatbot==1.5.3
|
||||
idna==2.10
|
||||
iniconfig==1.1.1
|
||||
jsonpath==0.82
|
||||
packaging==20.9
|
||||
pluggy==0.13.1
|
||||
py==1.10.0
|
||||
PyMySQL==1.0.2
|
||||
pyparsing==2.4.7
|
||||
pytest==6.2.4
|
||||
pytest-ordering==0.6
|
||||
pytest-rerunfailures==10.0
|
||||
PyYAML==5.4.1
|
||||
requests==2.25.1
|
||||
requests-toolbelt==0.9.1
|
||||
simplejson==3.17.2
|
||||
six==1.16.0
|
||||
toml==0.10.2
|
||||
urllib3==1.26.5
|
|
@ -4,7 +4,7 @@ import os
|
|||
from config.confManage import dir_manage
|
||||
from scripts.readYamlFile import ini_yaml
|
||||
from scripts import root_path
|
||||
|
||||
import time
|
||||
|
||||
def getFilePathList(rootpath, filetype):
|
||||
filepath = []
|
||||
|
@ -35,8 +35,17 @@ def write_case():
|
|||
if not os.path.exists(casepath + midp):
|
||||
os.makedirs(casepath + midp)
|
||||
if not os.path.exists(case):
|
||||
|
||||
t1 =time.strftime("%Y/%m/%d %H:%M")
|
||||
with open(case, 'w', encoding='utf-8') as f:
|
||||
f.write(f"""from test_suite.testcase.{testname} import *
|
||||
f.write(f"""# coding:utf-8
|
||||
\"\"\"
|
||||
@author: jing
|
||||
@contact: 529548204@qq.com
|
||||
@file: test_{filename}.py
|
||||
@time: {t1}
|
||||
\"\"\"
|
||||
from test_suite.testcase.{testname} import *
|
||||
|
||||
paramData = ini_yaml("{file}")
|
||||
|
||||
|
|
Loading…
Reference in New Issue