chuangliangProject/api_auto_framework/generate_test.py

41 lines
1.5 KiB
Python
Raw Permalink Normal View History

2025-09-18 08:49:12 +00:00
# -*- coding: utf-8 -*-
"""
@Time : 2025/7/30 10:59
@Auth : 九月的海
@File : generate_test.py.py
@IDE : PyCharm
@Motto : Catch as catch can....
"""
from core.curl_converter import CurlConverter
curl_example = r"""
curl 'https://cli1.mobgi.com/Baidu/Common/baiduRequest' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: zh-CN,zh;q=0.9' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json;charset=UTF-8' \
-b 'chuangliang_session=UBPWTe0ZQisVQsJdmcZVblYLTtrm58Ccm3Yb4ofL; userId=100362; idea_token=cc39ab3c-892d-11f0-94a2-00163e5c152e' \
-H 'Origin: https://cl.mobgi.com' \
-H 'Pragma: no-cache' \
-H 'Referer: https://cl.mobgi.com/' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Site: same-site' \
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36' \
-H 'client-user: 100362' \
-H 'ff-request-id: 202509042007234bbedf401c104521a788a0a4b70e58ec' \
-H 'main-user-id: 100362' \
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Google Chrome";v="139", "Chromium";v="139"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "Windows"' \
--data-raw '{"media_account_id":12472176893,"url":"ImageManagementService/qualityCheck","api_type":"feed","body":{"imageUrls":["https://feed-image.baidu.com/0/pic/-269653120_1670284112_-114565096.jpg"]}}'
"""
# 生成测试用例
case_path, data_path = CurlConverter.generate_test_case(curl_example, "百度检测低质封面")