You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
2.0 KiB
45 lines
2.0 KiB
|
6 days ago
|
# -*- coding: utf-8 -*-
|
||
|
|
"""票 02 排查:F08 attachment/add 缺省 bizType 的实际返回码(D-21 修复回归验证)。"""
|
||
|
|
import io
|
||
|
|
import sys
|
||
|
|
|
||
|
|
import requests
|
||
|
|
|
||
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||
|
|
|
||
|
|
BASE = 'http://localhost:8080'
|
||
|
|
r = requests.get(f'{BASE}/api/auth/debug/token', params={'userId': '744842565802524672'}, timeout=15)
|
||
|
|
tok = r.json()['data']
|
||
|
|
H = {'Authorization': f'Bearer {tok}'}
|
||
|
|
|
||
|
|
# 上传一个文件(MinIO 凭据已在服务端)
|
||
|
|
r = requests.post(f'{BASE}/api/file/upload', headers=H,
|
||
|
|
files={'file': ('repro-biztype.txt', b'repro', 'text/plain')},
|
||
|
|
params={'bizDomain': 'opportunity'}, timeout=30)
|
||
|
|
b = r.json()
|
||
|
|
print('upload:', b.get('code'), b.get('data', {}).get('fileId') if isinstance(b.get('data'), dict) else b.get('data'))
|
||
|
|
fid = b['data']['fileId'] if isinstance(b.get('data'), dict) else b['data']
|
||
|
|
|
||
|
|
# A2 商机 id(seed manifest)
|
||
|
|
import json
|
||
|
|
mf = json.load(open(r'.scratch\opportunity-e2e\seed-manifest.json', encoding='utf-8'))
|
||
|
|
a2 = next(str(o['id']) for o in mf['opportunities'] if '智慧园区二期' in o['name'])
|
||
|
|
|
||
|
|
# 缺省 bizType → 期望 66001(D-21 修复后语义)
|
||
|
|
r = requests.post(f'{BASE}/api/opportunity/attachment/add', headers=H,
|
||
|
|
data={'oppId': a2, 'fileId': fid, 'materialType': '', 'remark': '票02复现'},
|
||
|
|
timeout=30)
|
||
|
|
print('attachment/add 缺省 bizType:', r.status_code, r.json())
|
||
|
|
|
||
|
|
# 非法 bizType → 期望 66001
|
||
|
|
r = requests.post(f'{BASE}/api/opportunity/attachment/add', headers=H,
|
||
|
|
data={'oppId': a2, 'fileId': fid, 'bizType': 'NOT_IN_ENUM', 'materialType': ''},
|
||
|
|
timeout=30)
|
||
|
|
print('attachment/add 非法 bizType:', r.status_code, r.json())
|
||
|
|
|
||
|
|
# 正常 bizType=OPP → code 0
|
||
|
|
r = requests.post(f'{BASE}/api/opportunity/attachment/add', headers=H,
|
||
|
|
data={'oppId': a2, 'fileId': fid, 'bizType': 'OPP', 'materialType': ''},
|
||
|
|
timeout=30)
|
||
|
|
print('attachment/add bizType=OPP:', r.status_code, r.json())
|