python接口自动化测试二十四:上传多个附件,参数化


# 添加多个附件参数化
files = [("1.png", "1.png")
("2.png", "2.png")
]
def addFiles(files, n=1):
file = []
for i in list(range(n)):
a =("files[]", (files[i][1], open(files[i][2], "rb"), "image/png"))
b = ("labels[]", (None, '附件标题1')),
("files[]", ("2.png", open("d:\\2.png", "rb"), "image/png")),
("labels[]", "tu2"),
file.append(a)
file.append(b)
return file

 


posted @ 2018-06-09 17:08  向前走。  阅读(947)  评论(0编辑  收藏  举报