验证我的数字组件,列表翻页功能支持脚本

#coding:utf-8
import unittest,requests,time

class PublishDigitalDocuments(unittest.TestCase):
    '''数字组件发布'''
    def test_01(self):
        '''数字组件发布'''
        for i in range(0,100):
            componentName = "test" + str(time.time())[-7:]
            print(componentName)
            payload1 = {
                "componentLabel": ["D001"],
                "componentName": componentName,
                "componentType": "D010",
                "componentValue": "{\"cid\":\"compId-x\",\"type\":\"component\",\"title\":\"组件名称\",\"eCodes\":[\"ecode-a\",\"ecode-b\",\"ecode-c\",\"ecode-d\"],\"values\":[{\"ecode-a\":\"ecode-a 数据\"},{\"ecode-b\":\"ecode-b 数据\"},{\"ecode-c\":\"ecode-c 数据\"},{\"ecode-d\":\"ecode-d 数据\"}]}",
                "enterpriseId": "1",
                "keywords": ["关键词1","关键词2","关键词3","关键词4","关键词5"]
            }
            s = requests.session()
            #拼接请求地址
            url_api = "xxx"
            #请求头部
            headers2 = {
            "Content-Type": "application/json",
             }
            r = s.post(url=url_api,headers=headers2,json=payload1)
            print(r.json())

if __name__=="__main__":
    unittest.main()

 

posted @ 2021-10-20 17:00  Camillezxl  阅读(32)  评论(0编辑  收藏  举报