test/test77.py

89 lines
4.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import requests
import uuid
import time
# from auth import create_access_token
data={
"user_id": str(uuid.UUID),
"role": "admin",
"fp":int(time.time()),
}
jwt=requests.post("http://localhost:8080/login",json=data).json()['access_token']
#TODO 这里是巨量百应的ck
data2 = {
'BUYIN_SASID': 'SID2_7492981858080112935',
'SASID':'SID2_7492981858080112935'
}
#TODO 这里是抖音的ck
data1 = {
'ttwid': '1%7CUVB51cDI7GY0yyiCBtrU5IoTdHixuxTrNykHrPzbRCk%7C1744392589%7Cb0ed96d039d373f75e9f86983304ad70532dd23a4df1af69f1b0828103c1b6e5',
'n_mh': 'geOcP6qU-laruJUx6JHMEUZkPwLFtVmTFaO3fJ46gMI',
'sid_guard': '9e24a6486603b34cc5c60a16712a9fb3%7C1744596869%7C5184000%7CFri%2C+13-Jun-2025+02%3A14%3A29+GMT',
'uid_tt': 'adb3fcdab0d4ed5626f9a3c5c4a5bf47',
'uid_tt_ss': 'adb3fcdab0d4ed5626f9a3c5c4a5bf47',
'sid_tt': '9e24a6486603b34cc5c60a16712a9fb3',
'sessionid': '9e24a6486603b34cc5c60a16712a9fb3',
'sessionid_ss': '9e24a6486603b34cc5c60a16712a9fb3',
'is_staff_user': 'false',
'sid_ucp_v1': '1.0.0-KDk3OTIzZTIxZDJmZDMxYWIyOTVlODU5NmQyMDhhOTQ2OGQ2MTYzMDcKIQjNiNDHsIz1BxCF3_G_BhjvMSAMMMafwpEGOAdA9AdIBBoCbHEiIDllMjRhNjQ4NjYwM2IzNGNjNWM2MGExNjcxMmE5ZmIz',
'ssid_ucp_v1': '1.0.0-KDk3OTIzZTIxZDJmZDMxYWIyOTVlODU5NmQyMDhhOTQ2OGQ2MTYzMDcKIQjNiNDHsIz1BxCF3_G_BhjvMSAMMMafwpEGOAdA9AdIBBoCbHEiIDllMjRhNjQ4NjYwM2IzNGNjNWM2MGExNjcxMmE5ZmIz',
'login_time': '1744596869897',
'IsDouyinActive': 'true',
'publish_badge_show_info': '%220%2C0%2C0%2C1744596872958%22',
'xg_device_score': '7.523030082041696',
'SelfTabRedDotControl': '%5B%5D',
'_bd_ticket_crypt_cookie': '15005b8d8b6ad1f68d33b050cfdf481e',
'__security_mc_1_s_sdk_sign_data_key_web_protect': '82669e23-4437-b1c5',
'__security_mc_1_s_sdk_cert_key': 'f4c89aed-4e94-bacb',
'__security_server_data_status': '1',
'bd_ticket_guard_client_data': 'eyJiZC10aWNrZXQtZ3VhcmQtdmVyc2lvbiI6MiwiYmQtdGlja2V0LWd1YXJkLWl0ZXJhdGlvbi12ZXJzaW9uIjoxLCJiZC10aWNrZXQtZ3VhcmQtcmVlLXB1YmxpYy1rZXkiOiJCUE8wVmY0bGZmSGlldGhPblN1MFNVM1pHR3Vwbk9CUlE2UElUTlY0WGphWko2V2EvMmkrMVhVN0hUQWM2VFpsSXRkTnA4Q1JqRHZzdXh5SEpRZGlES2c9IiwiYmQtdGlja2V0LWd1YXJkLXdlYi12ZXJzaW9uIjoyfQ%3D%3D',
'passport_fe_beating_status': 'true',
'odin_tt': '7281e3ee93766f632e95b0ad354335ee955ebc379555617fbc680eb18d393f054d84e37c9cec7f01214eddd9a5749c55596ae87f5995403c92e7a268f5fafed7',
'live_can_add_dy_2_desktop': '%221%22',
'volume_info': '%7B%22isMute%22%3Afalse%2C%22isUserMute%22%3Afalse%2C%22volume%22%3A0.6%7D',
'download_guide': '%223%2F20250414%2F0%22',
}
headers = {
"Authorization": f"Bearer {jwt}"
}
import unittest
class MyTestCase(unittest.TestCase):
'''
测试识别
'''
def test_identify_products(self):
params={
"urls":"https://haohuo.jinritemai.com/ecommerce/trade/detail/index.html?id=3702192299720179773&origin_type=2631,https://haohuo.jinritemai.com/views/product/item2?id=3741702496180109752"
}
result=requests.post("http://localhost:8080/identify_products",json=data2,params=params,headers=headers)
print(f"result.json()---->{result.json()}")
'''
测试增加商品
'''
def test_add_products(self):
params = {#请注意这里url要与id对应顺序对应
"link_url":"https://haohuo.jinritemai.com/ecommerce/trade/detail/index.html?id=3702192299720179773&origin_type=2631,https://haohuo.jinritemai.com/views/product/item2?id=3741702496180109752",
"promotion_ids":"3702192299720179773,3741702496180109752"
}
result=requests.post("http://localhost:8080/add_products",json=data2,params=params,headers=headers)
print(f"result.json()---->{result.json()}")
'''
测试删除
'''
def test_del_unbind(self):
params = {
"promotion_ids": "3723494051140468845,3568029813883172377"
}
result=requests.post("http://localhost:8080/del_unbind",json=data2,params=params,headers=headers)
print(f"result.json()---->{result.json()}")
'''
测试小黄车
'''
def test_get_yellow_car(self):
params={"room_id":"7493339316282723123",
"author_id":"1626907841411991"
}
result = requests.post("http://localhost:8080/get_yellow_car_products", json=data1, params=params, headers=headers)
print(f"result.json()---->{result.json()}")